HTML:
<br/><button class="btn btn-primary" ng-disabled="enableCompare()" ng-click="on_compare_plateformes($item)">Comparer</button>
JS:
propertiesModule.controller('PropertiesComparePlateformesCtrl', ['$scope', 'compareService', '$routeParams', 'PropertiesService', 'ApplicationService', 'PlatformService', 'Page', function ($scope, compareService, $routeParams, PropertiesService, ApplicationService, PlatformService, Page) {
$scope.on_compare_plateformes = function () {
...
};
..
}]);
propertiesModule.directive('propertiesListCompare', ['compareService', function (compareService) {
return {
restrict: 'E',
scope: {
properties: '=',
propertiescible: '=',
application: '=',
applicationcible: '=',
undo: '=',
myselectref: '=',
myselectcible: '='
},
templateUrl: "properties/properties-list-compare.html",
link: function (scope, element, attrs) {
// scope.$watch("propertiescible", function () {
var unregister = scope.$watch('[properties, propertiescible]',function () {
...
}, true);
...
unregister();
}
};
}]);
ボタンをクリックしたときに $watcher を再バインドする方法。