4
所以,我有一個表單,我需要使用自定義指令。 我需要什麼:將user
模型傳遞給指令。傳遞模型屬性到自定義指令
<form>
<input type="text" ng-model="user.login">
<input type="password" ng-model="user.password">
<span ng-custom-directive ng-model="user.testfield"></span>
</form>
指令模板看起來是這樣的:
<span><input type="checkbox" ng-model="[HERE I NEED user.testfield TO WORK WITH user]"> </span>
我怎樣才能通過user
模型來指導模板?
表格後提交我需要user.testfield
是在$scope.user
喜歡可供選擇:
console.log($scope.user)
{
login: 'test',
password: 'test',
testfield: true|false
}
請張貼鏈接到類似的問題。謝謝! – 2014-11-03 16:54:54
http://stackoverflow.com/questions/20828046/watch-ng-model-inside-directive – coldmind 2014-11-03 16:55:41