In the following code, when the data is saved, the console.log(user) is returning undefined. What is wrong here?
<input type="text" class="form-control" id="inputEmail" placeholder="Name" ng-model="user.name">
<a class="btn btn-link pull-right" ng-click="save(user)">Save</a>
Controllers:
LControllers.controller( 'InstanceCtrl', ['$scope', 'Instance', 'User',
function ($scope, Instance , User) {
$scope.user= '';
$scope.save = function (user) {
console.log(user)// undefined
console.log(user.name)
};
JSFiddle: http://jsfiddle.net/U3pVM/15248/
useris undefined orconsole.loguserinstead ofuse.nameinsideng-modelundefinedeven after you typed something in the text field?