I try to make a custom directive (here a progress-bar). Here is its declaration in the HTML :
<body ng-app="progressBar" ng-controler="progressBarCtrl">
<pb widthb="20" heightb="100"></pb>
<button ng-click="setProgress(10)">set to 10</button>
</body>
And here my module declaration :
angular.module('progressBar', [])
//
// Directive that generates the rendered chart from the data model.
//
.directive('pb', function() {
return {
restrict: 'EA',
templateUrl: "flowchart/progress-bar.html",
replace: true,
controller: 'progressBarCtrl',
scope :{
widthb: '=',
heightb: '='
}
};
})
.controller('progressBarCtrl', ['$scope', function progressBarCtrl ($scope) {
$scope.progress=60;
$scope.setProgress = function (value) {
if (value>100){
value=100;
}
if (value<0){
value=0;
}
$scope.progress=value;
};
}]);
Clicking on the button "set to 10" will never call the function.