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

bindToController not working with latest angular 1.6.4 #56

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
33 changes: 19 additions & 14 deletions src/imageCropperDirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,31 @@ module.exports = function(angular, Cropper) {
width: '@',
zoomStep: '@',
actionLabels: '&'
},
bindToController: true,
},
controllerAs: 'vm',
controller: function() {
controller: function($scope) {
var self = this;

// Get action labels.
this.actionLabels = this.actionLabels();
//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 = this.api();
this.cropCallback = this.cropCallback();
// Get callback.
this.apiCallback = $scope.api();
this.cropCallback = $scope.cropCallback();

// Eval for boolean values.
this.fitOnInit = eval(this.fitOnInit);
this.centerOnInit = eval(this.centerOnInit);
this.checkCrossOrigin = eval(this.checkCrossOrigin);
this.showControls = eval(this.showControls);
// 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.init = function() {
this.target = this.element;
this.api = new Cropper(self);
}
Expand Down