angularjs - Can't bind scope variable to array key? -


यह क्यों हो रहा है?

  & lt; input type = "text" ng- मॉडल = "पता" / & gt; App.controller ("MainCtrl", ['$ scope', फ़ंक्शन ($ गुंजाइश) {$ scope.location = {पता: $ scope.address}; $ scope.getFood = function () {console.log ($ scope। स्थान); console.log ($ scope.address)}  

लॉगिंग $ scope.location देता है

  वस्तु {पता: अपरिभाषित}  

जब मैं $ scope.address पर लॉग इन करता हूं, तो यह मुझे मूल्य देता है।

आप $ scope.location = {address: null};
सेट कर सकते हैं और फिर अपने मार्कअप में & lt; input type = "text" ng-model = "location.address "/ & Gt;


Comments

Popular posts from this blog

c++ - C/pp Sockets, recv()/send() works only under gdb -

GO: Serve static pages -

objective c - How to open front/back camera at the same time in iOS developing? -