var app = angular.module('plunker', []);
app.controller('MainCtrl', function($scope) {
$scope.hello='hell2o';
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);
};
}
};
});
});
<!DOCTYPE html>
<html ng-app="plunker">
<head>
<meta charset="utf-8" />
<title>AngularJS Plunker</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<script>
document.write('<base href="' + document.location + '" />');
</script>
<link rel="stylesheet" href="style.css" />
<script data-require="angular.js@1.2.x" src="https://code.angularjs.org/1.2.22/angular.js" data-semver="1.2.22"></script>
<script src="app.js"></script>
</head>
<body ng-controller="MainCtrl">
<reset-filter></reset-filter>
name: {{hello}}
<input type="text" ng-model='hello' />
</body>
</html>
/* Put your css in here */
This is a plunk of using angular-ui typeahead and tooltip inside an ng-table.
It appears to work if you look at the plunker. However, if you download the
code and run it locally or from a server you will find that it causes the
following error on load, when mousing over a row, and when selecting an
item from the typeahead.
TypeError: Cannot read property 'length' of undefined
at Scope.scope.isOpen (file:///C:/Downloads/plunk-sw/ui-bootstrap-tpls-0.11.0.js:3756:31)
at Object.get (https://code.angularjs.org/1.2.22/angular.js:10821:21)
at Scope.$digest (https://code.angularjs.org/1.2.22/angular.js:12489:40)
at Scope.$apply (https://code.angularjs.org/1.2.22/angular.js:12762:24)
at HTMLInputElement.<anonymous> (https://code.angularjs.org/1.2.22/angular.js:19061:21)
at https://code.angularjs.org/1.2.22/angular.js:2843:10
at forEach (https://code.angularjs.org/1.2.22/angular.js:325:18)
at HTMLInputElement.eventHandler (https://code.angularjs.org/1.2.22/angular.js:2842:5)
If anyone knows how to fix this I'd be greatful for the help. Here's the stack overflow link.
http://stackoverflow.com/questions/25751800/angularui-with-typeahead-and-tooltip-in-ngtable-with-custom-header-length-undefi
<div>
This is the filter:
<a href="#" ng-click="resetFilter()">Reset Filter</a>
</div>