0
각도 JS 나에게각도 오류 NG-경우
[1]http://errors.angularjs.org/1.2.10/$parse/lexerr?p0=Unterminated%20quote&p1=s%2013-14%20%5B'%5D&p2=recipe.ID%20!%3D%3D'
내가 솔루션을 적용하는 방법을 잘 모릅니다이 오류 링크를 반환. 도와주세요. 감사 내 자바 스크립트 : 웹 API에서
var app = angular.module('sample', [])
app.directive("otcDynamic", function ($compile) {// compile Json data return and wrap inside html
return {
link: function (scope, element) {
var template = global.userhtml;
var linkFn = $compile(template);
var content = linkFn(scope);
element.append(content);
}
}
});
JSON 데이터 반환
var global {
userhtml ='<table class="recipe-table" cellspacing="0" cellpadding="0"><tbody><tr class="recipe-list" data-ng-repeat="recipe in recipe_data" ng-if="recipe.Keyword == keyw.Keyword" ><td id="td-img{{recipe.CodeListe}}" rowspan="2"><center><span id="img{{recipe.ID}}X"><a id="{{recipe.ID}}" href="javascript:void(0);"> <img ng-if="recipe.ID !==''" fallback-src="images/default.png" ng-src="{{recipe.Pictures}}" class="images" id="img{{recipe.ID}}"/><img ng-if="recipe.Pictures===''" class="images" src="images/default.png" id="img1"/></a></span></center></td><td class="recipes"><div id="drn" class="div-recipe-name"><strong>{{recipe.Name}}</strong></div><br /><div id="drd" class="div-recipe-desc">{{recipe.desc}}</div><div class="div-recipe-allergen">{{recipe.allergen}}</div><div class="div-recipe-cost">{{recipe.cost}}</div></td></tr></tbody></table>'
}
내 HTML :
이<accordion close-others="false">
<div>
<accordion-group class="div-recipe-header">
<accordion-heading></accordion-heading>
<my-directive></my-directive>
<div otc-dynamic></div>
</accordion-group>
</div>
</accordion>
웹 API에서 반환 된 데이터가 유효한 JSON이 아닙니다. 그것은 심지어 유효한 자바 스크립트가 아닙니다. –
사실 그것은 성공적으로 컴파일되지만, 조리법 ID와 조리법 인 경우에는 부분적으로 컴파일되지 않습니다. 나는 Json이 읽을 수 있도록 백 슬래시를 넣어야한다는 것을 알고 있습니다. 하지만 SQL 서버에 백 슬래시가있는 데이터를 삽입 할 수 없습니다. 도와주세요 어떻게 내 json 유효하게 만들 수 있습니다 .. – KeenEgs
다음 컴파일하면 API에 의해 반환 된 실제 데이터 수 없습니다. 내가 말했듯이 그것은 유효한 자바조차도 아니다. –