I have directive which dynamically creates input tags. I need to get values of created inputs on change event. Instead of it the name attribute on $scope argument in the controller is undefined. How to get ng-model value in the directive controller?
module.directive('createControl', function($compile, $timeout){
return {
transclude: true,
restrict: 'A',
scope: {
name: '=name'
},
link: function(scope, element, attrs){
// simplified version
tag = '<input type="text" ng-model="name"/>'
element.append(html);
controller: function($scope){
// In the controller I need to get value of created input on change event
console.log($scope);
}
}
});