javascript - AngularJS directive with template having ng-repeat and ng-bind-html -


मैंने ng-repeat वाले टेम्पलेट के साथ एक डायरेक्टिव बनाया है और ng-bind-html जैसा नीचे दिया गया है

  app.directive ('customField', फ़ंक्शन ($ संकलन) {var getTemplate = function (customType) {return '& lt; Span ng-repeat = "custom.options में विकल्प" ng-bind-html = "option" & gt; & lt; / span & gt; '}} var linker = समारोह (क्षेत्र, तत्व, attrs) {element.html (getTemplate (scope) .custom.Ttype)। शो (); $ संकलन (element.contents ()) (गुंजाइश);} वापसी {प्रतिबंधित: "ई", rep1ace: true, link: linker, scope: {custom: '='} };});  

लेकिन यह त्रुटि देता है: त्रुटि: [$ sce: असुरक्षित] किसी सुरक्षित संदर्भ में असुरक्षित मान का उपयोग करने का प्रयास करना

इसमें सामान्य परिदृश्य मैं इस प्रकार के मुद्दे को हल करने के लिए $ sce.trustAsHtml (html_code); का उपयोग करता हूं, लेकिन एनजी-दोहराने के साथ निर्देश में यह कैसे हल करें?

< / Div>


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -