angularjs - Syntax danger: Token '}' is unexpected, expecting [:] at column 35 of the expression [yourSelectRadio={item.Polarisation}] -


  त्रुटि: त्रुटि: [$ parse: syntax] सिंटेक्स खतरे: टोकन '}' अप्रत्याशित है, उम्मीद है [: ] अभिव्यक्ति के स्तंभ 35 पर [अपने सेलेक्ट रेडियो = {item.Polarisation}] [}] से शुरू हो रहा है। http://errors.angularjs.org/1.2.21/$parse/syntax?p0=%7D&p1=is%20unexpected%2C%20expecting%20%5B%3A%5D&p2=35&p3=yourSelectRadio% 3D% 7Bitem.Polarisation% 7D & amp; p4 =% 7D   

मेरा कोड:

  & lt; div class = "btn-group" ng-init = "yourSelectRadio = {} item.Polarisation" & gt; & Lt; label class = "btn btn-success ng-pristine ng-valid" ng- मॉडल = "yourSelectRadio" बीटीएन-रेडियो = "'वर्टिकल'" & gt; वर्टिकल & lt; / label & gt; & Lt; label class = "btn btn-success ng-pristine ng-valid" ng- मॉडल = "yourSelectRadio" बीटीएन-रेडियो = "'क्षैतिज'" & gt; क्षैतिज & lt; / label & gt; & Lt; / div & gt;   

यह त्रुटि क्यों होती है?

{} एक है वस्तु आपको आइटम के लिए एक कुंजी की आवश्यकता है

  {'key': item.Polarisation}?   

या

  yourSelectRadio = item.Polarisation // यदि यह एक वस्तु है   

संपादित करें < / Strong>:

एनजी-इनइट फ़ंक्शन को एक वस्तु की आवश्यकता है JSON को {"key": "value"} के रूप में परिभाषित किया गया है नहीं {[OBJECT]}

मान लेना item.Polarisation ~ = { "बात": "एक", "अन्य चीज़": 2}

त्रुटि को ठीक करने के दो तरीके हैं

प्रत्यक्ष असाइनमेंट

  & lt; div class = "btn-group" ng-init = "yourSelectRadio = item.Polarisation" & gt;   

या

इनकैप्सुलेशन

  & lt; div class = "btn-group" एनजी -init = "yourSelectRadio = {'radioItem': item.Polarisation}" & gt;    

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -