Simple AngularJS scope issue (newbie) -


i'm trying figure out how user's email passed controller i'm getting undefined $scope.user.email. $scope defined there's no user object in there. there wrong code?

html

<label class="item item-input">   <span class="input-label">email</span>   <input ng-model="user.email" type="text"> </label> <button ng-click="signinclick()" class="button button-full button-positive">     sign in </button> 

controller

.controller('welcomectrl', function($scope) {     $scope.signinclick = function() {         console.log($scope.user.email);     } }) 

edits

the controller linked via js/apps.js , runs when button clicked know it's linked welcomectrl.

because $scope.user undefined.

.controller('welcomectrl', function($scope) {     $scope.user = {};     $scope.signinclick = function() {         console.log($scope.user.email);     } }) 

Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -