angular-image-cropper icon indicating copy to clipboard operation
angular-image-cropper copied to clipboard

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

Open angular-tools opened this issue 8 years ago • 8 comments

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

angular-tools avatar Jan 26 '17 02:01 angular-tools

Facing the same problem...

monsieur-ricky avatar Mar 08 '17 16:03 monsieur-ricky

+1

xitasoappdev avatar Mar 14 '17 15:03 xitasoappdev

me too trying to go around it nothing seems to work

theoomoregbee avatar Apr 04 '17 23:04 theoomoregbee

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 avatar Apr 05 '17 12:04 theoomoregbee

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

theoomoregbee avatar Apr 05 '17 12:04 theoomoregbee

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 avatar Apr 10 '17 13:04 tomchi89

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

theoomoregbee avatar Apr 10 '17 14:04 theoomoregbee

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 

victorhazbun avatar Jul 11 '17 21:07 victorhazbun