The code was working fine when I hard coded a character limit, but as soon as I introduce the $scope.model.config.limit, it stops working (if I look at $scope.model.config in Chrome inspector, it just says "Object", and there is no limit property).
I can see that my limit property is there when I edit the datatype (/developer/dataTypes/edit/id), but it is not there when editing the content itself.
I've been scratching my head (and banging it against my desk) for a while now.
I found the download for the source code, and copied / pasted it over my own work. I also made sure my cache is cleared and application fully restarted by changing web.config.
I'm not sure if it is relevant, but I am debugging through Visual Studio 2015, and I am using the latest version of Umbraco (7.7.8). I have the same problem in Chome and Firefox.
The code, as I say, is a direct copy of what is available from the website, but for info, here it is:
charlimit.controller.js:
angular.module("umbraco").controller("Example.CharLimitController", function ($scope) {
$scope.limitchars = function () {
var limit = $scope.model.config.limit;
if ($scope.model.value.length > limit) {
$scope.info = 'You cannot write more then ' + limit + ' characters!';
$scope.model.value = $scope.model.value.substr(0, limit);
}
else {
$scope.info = 'You have ' + (limit - $scope.model.value.length) + ' characters left.';
}
};
});
Property Editor Settings example not working?
Hello, I'm new to Umbraco and to Angular, so apologies if this is a stupid question.
I have followed the video tutorials on umbraco.tv, and am currently adding settings to a property editor: https://umbraco.tv/videos/umbraco-v7/developer/extending/property-editors/using-services/
The code was working fine when I hard coded a character limit, but as soon as I introduce the $scope.model.config.limit, it stops working (if I look at $scope.model.config in Chrome inspector, it just says "Object", and there is no limit property).
I can see that my limit property is there when I edit the datatype (/developer/dataTypes/edit/id), but it is not there when editing the content itself.
I've been scratching my head (and banging it against my desk) for a while now.
I found the download for the source code, and copied / pasted it over my own work. I also made sure my cache is cleared and application fully restarted by changing web.config. I'm not sure if it is relevant, but I am debugging through Visual Studio 2015, and I am using the latest version of Umbraco (7.7.8). I have the same problem in Chome and Firefox.
The code, as I say, is a direct copy of what is available from the website, but for info, here it is:
charlimit.controller.js:
charlimit.editor.html:
package.manifest:
Hi Graham
What you added property editor to the document type, did you set value for a limit configuration?
You can do it in the add property to the docType, please, have a look at this gif:
Thanks,
Alex
Aha! Thank you so much.
So, what is the purpose of the setting that I did set then? The one in umbraco#/developer/dataTypes/edit/
Is that just a red herring? Surely not?
The purpose of the setting that is that you can specify property editor configuration for each document type.
If you need the same configuration for all document Type - use default configuration - https://our.umbraco.org/documentation/extending/property-editors/package-manifest#default-config
/Alex
is working on a reply...