angular-image-cropper
angular-image-cropper copied to clipboard
Problems with angular 1.6.x: this.actionLabels is not a function
Hi,
I'm getting this error ever since I've upgraded to Angular v1.6.x: this.actionLabels is not a function
.
I even tried the homepage demo with the new version of Angular and the same error is showing. If I revert the Angular version, the error goes away.
Any ideas what is causing this and how to fix it?
Thanks, San
Facing the same problem...
+1
me too trying to go around it nothing seems to work
finally gotten a way around it is the bindToController that is causing it , commented it out and changed the dist .js file to not use it again
//bindToController: true,
controllerAs: 'vm',
controller: function($timeout, $scope) {
var self = this;
//get values for non eval boolean variables
this.imageUrl = $scope.imageUrl;
this.width = $scope.width;
this.height = $scope.height;
this.zoomStep = $scope.zoomStep;
// Get action labels.
this.actionLabels = $scope.actionLabels();
// Get callback.
this.apiCallback = $scope.api();
this.cropCallback = $scope.cropCallback();
// Eval for boolean values.
this.fitOnInit = eval($scope.fitOnInit);
this.centerOnInit = eval($scope.centerOnInit);
this.checkCrossOrigin = eval($scope.checkCrossOrigin);
this.showControls = eval($scope.showControls);
this.init = function() {
this.target = this.element;
this.api = new Cropper(self);
}`
theo4u it is works but throwing another issue with scope so I would not recommended that options as a fix. If for some reason you cannot downgrade angular to 1.5.x you can add this configuration to allow bindings back outside $onInit.
.config(($compileProvider) => { 'ngInject'; $compileProvider.preAssignBindingsEnabled(true); });
But I would consider this as temporary solution as this config can work for entire app.
@tomchi89 cool, about the scope issue , what kind of issue is thrown , so i know
angular.js:15168 TypeError: this.actionLabels is not a function at new controller (imageCropperDirective.js:31) at Object.invoke (angular.js:4775) at S.instance (angular.js:11007) at n (angular.js:9793) at g (angular.js:9069) at n (angular.js:9373) at g (angular.js:9069) at angular.js:8968 at angular.js:9862 at d (angular.js:9169) undefined