I know that you can bind a directive by:
Html:
<mydirective />
Js:
app.directive('mydirective', function () {})
However I saw this SO answer. So is it possible to bind a directive like?
Html:
<input ng-something="foo()">
Js:
app.directive('ngSomething', function () {})
Or I should always have template:
inside the directive so as I inject the code. My purpose is to bind a ng-keydown
on an existing input:
This does not work :
<input type="text", placeholder="Search stuff" ng-model="searchBar" ng-keydown="dosomthg()">
So I'm trying based on the above answer:
<input type="text", placeholder="Search stuff" ng-model="searchBar" ngSearchbar="dosomthg()">