angularjs - What scenarios force me to setup workarounds for ng-model in angular? -
typically in situations, able setup ng-model on element in standard fashion follows.
<textarea ng-model="messagetext"></textarea>
but ng-model not update within scope. have force work doing this
<textarea ng-model="messagetext" ng-change="updatemessagetextscope(messagetext)" ></textarea> $scope.updatemessagetextscope = function (messagetext) { $scope.messagetext = messagetext; }
in above setup, if leave out ng-change, ng-model appears buggy. adding {{messagetext}} html seems indicate messagetext updating, when comes time submit data api, messagetext contain different data {{messagetext}} on ui showing me. different data, mean updates ng-model value 1 time... if type new data textarea, ui output indicates updated new value, scope stuck using original value.
it's not frequent (1% or less), confused causes in first place.
Comments
Post a Comment