I have a directive like this.
app.directive('updateinfo', function() {
function link(scope, element, attrs) {
function update(){
var str = '<input type="text" ng-model="scope.log1" />';
element.html(str);
}
update();
}
return {
link: link
};
});
The directive shows a text input box, but it does not show the scope.log1value and the changes made in the textbox are not reflected in the scope variable. I want to use the link function because I want to access other scope variables. Is there a way to use link function and still bind data to scope variable.
I appreciate any help.
$compileif you want to directly modify the DOM.