My Html:
<test-app email="[email protected]"></test-app>
My Directive:
.directive('testApp', function () {
return {
restrict: 'E',
scope: {
userEmail = '@userEmail'
},
templateUrl: 'Form.html'
};
})
My Form in another Page:
<label> Email </label>
<input type="text" id="email">
Issue: I need to get the parameter value , and print it out on the textbox itself.
What i have done: I research on a lot of articles which demonstrated on how to pass directive parameters to controller but they were very complicated.
What i think is the next step:
1) Pass the directive parameter to the controller and then bind the controller to the textbox and set the value of the textbox to be the parameter value.
2) Or is there another way i can do this?
I am stuck on how to proceed on.
makeBoldthen use it in template like:<make-bold ...> </make-bold>emailvalue in directive, correct? so try this:scope: { userEmail: '@email'},and in your template:<input type="text" ng-model="userEmail" id="email">check about isolated scope in detail here