I built a directive but is not displaying on the page? This is the code:
app.directive('resetFilter', function () {
return {
restrict:'E',
template:'<div> This is the filter: <a href="#" ng-click="resetFilter()">Reset Filter</a> </div>',
controller:function($scope){
$scope.resetFilter= function(){
console.log('resetfilter this one !!!!');
$scope.name=''
console.log('accname',$scope.name);
};
}
};
});
html looks like this:
<body ng-controller="MainCtrl">
<reset-filter></reset-filter>
name: {{hello}}
<input type="text" ng-model='hello' />
</body>
Also how can I trigger the resetFilter function? I want to reset the $scope.name value? plunk: http://plnkr.co/edit/rUCMq9?p=preview