angularjs - $scope.data undefined in controller -


i can't use $scope.data in controller, it's undefined, can please ?

thanks

contact.html

<textarea cols="40" rows="6" name="message" id="message" class="panelinputs" placeholder="message" ng-model="data.message" ng-change="displayscope()"></textarea> 

controllers.js

angular.module('boardline.controllers', ['boardline.services']) .controller('contactctrl', function($scope, $stateparams, sessionservice, isphonegap, isios) {   console.log($scope.data);   $scope.displayscope = function() {     console.log("displayscope : ");     console.log($scope.data);   } }) 

app.js

angular.module('boardline', ['ionic', 'ngcookies', 'ui.unique', 'boardline.controllers', 'boardline.services', 'boardline.filters']) 

you need define property data $scope.data = {} in controller first. because ng-model binds data.message, while data undefined. message cannot assigned.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -