So, I have a form where I need to use a custom directive. What I need: pass the user model directive.
<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>
The directive template is as follows:
<span><input type="checkbox" ng-model="[HERE I NEED user.testfield TO WORK WITH user]"> </span>
How can I pass the user model for a directive template?
After submitting the form, I need user.testfield be available in $scope.user as:
console.log($scope.user) { login: 'test', password: 'test', testfield: true|false }
source share