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
Post a Comment