I'm writing a wrapper for a jQuery element that is part of a template I'm working with.
The link method in the example here: http://jsfiddle.net/Webnet/ugSsk/ is not triggered. I can't get it to output to the console or alert.
Any suggestions?
JS:
angular.module('test', []).
directive('slideToggle', function () {
return {
scope: false,
replace: true,
template: '<input type="checkbox" name="" class="slideToggle"/>',
link: ['scope', 'element', 'attrs', function (scope, element, attrs) {
console.log(element);
alert('linked');
}],
controller: ['$scope', '$element', '$attrs', function ($scope, $element, $attrs) {
}]
}
});
HTML:
<div ng-app="test">
<div slide-toggle on="Active" off="Inactive"></div>
</div>