I'm trying to implement two way binding for custom directive in angularJs. Somehow its not working.
html file
<div ng-app='myApp'>Outside directive
<input type='text' ng-model='outAttr'>{{outAttr}}</br>
<div my-directive some-attr='outAttr'></div>
</div>
js file
var myApp = angular.module('myApp', []);
myApp.directive('myDirective', function () {
return {
restrict: 'A,
replace: true,
scope: {
inAttr: '=someAttr';
},
template: "<div><input type='text' ng-model='inAttr'>\
{{inAttr}}</div>"
}
})
Somehow its not working. here is JSFiddle link. Can someone help me pointing out my mistake. Thanks.