My directive contains in its template a simple input field, and I'm lookin for a solution to have control on that input field by using ngModel, but I don't know how to do.
Template:
<input name="myInput" ng-model="myInput" type="text"/>
Directive JS:
app.directive('ghPca', ['$http', '$q', function($http, $q) {
return {
restrict : 'E',
templateUrl : '/javascripts/ang/directives/pca/gh-pca-template.html',
scope : {
isEnable : '='
},
link : function($scope, $el, $attrs){
//how can I manage/control the input of THIS directive?
}
}
}]);
Directive use:
<gh-pca></gh-pca>
I don't know what to set up (write) in the controller/link to bind the input. Any suggestion?
SOLUTION
The solution I was looking for it's like that one here below
app.directive('ghPca', ['$http', '$q', function($http, $q) {
return {
restrict : 'E',
templateUrl : '/javascripts/ang/directives/pca/gh-pca-template.html',
scope : {
isEnable : '='
},
link : function($scope, $el, $attrs){
//how can I manage/control the input of THIS directive?
},
controller : function($scope) {
//here I can have control on my **$scope.myInput**
}
}
}]);