Skip to content
This repository has been archived by the owner on Nov 27, 2018. It is now read-only.

Problems with angular 1.6.x: this.actionLabels is not a function #54

Open
angular-tools opened this issue Jan 26, 2017 · 8 comments
Open

Comments

@angular-tools
Copy link

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

@ricky2k7
Copy link

ricky2k7 commented Mar 8, 2017

Facing the same problem...

@xitasoappdev
Copy link

+1

@theoomoregbee
Copy link

me too trying to go around it nothing seems to work

@theoomoregbee
Copy link

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

@theoomoregbee
Copy link

//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);
             }`

@tomchi89
Copy link

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.

@theoomoregbee
Copy link

@tomchi89 cool, about the scope issue , what kind of issue is thrown , so i know

@victorhazbun
Copy link

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


Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants