This directive contains a function that should be executed when clicked.
ebApp.directive('monthDir', function () {
return {
restrict: 'E',
templateUrl: 'htmlFiles/monthDirective.html',
transclude: true,
scope: {
ebObj: "=obj"
},
link: function link(scope, element, attrs, ngModelCtrl) {
scope.removeDir = function (removeVal) {
console.log("asd"); //this is not displaying in the console
}
console.log(scope);
},
controller: function ($scope) {
}
}
})
The ng-click event in the following directive is not functioning properly. Below is the directive's HTML:
<div class="row monthDirC">
<span class="glyphicon glyphicon-remove-sign pull-right cursorC"
ng-click="removeDir(ebObj.costArray[count])" ></span>
<div class="form-group">
<label for="datepick" class="col-md-6">Select month</label>
<md-datepicker id="datepick" class="col-md-6" ng-model="ebObj.costArray[count].myDate"
md-placeholder="Enter date"
md-min-date="minDate"
md-max-date="maxDate">
</md-datepicker>
</div>
This is how you use the directive in your HTML:
<div class="col-md-12">
<month-dir ng-transclude ng-repeat="count in ebObj.costArray[0].countArray" obj="ebObj.costArray[count+1]"></month-dir>
</div>