2013-07-24 4 views
11

내 데이터베이스에는 제품 정보가 저장되며 많은 정보가 목록으로 구성되어 있습니다. 데이터를 Angular에 $scope.post으로로드합니다. AngularJS - 문자열에 포함 된 HTML 태그 렌더링

$scope.post.size_description = '<li> Fits true to size. Take your normal size\r</li> 
    <li> Slim-cut, mid-rise style</li> 
    <li> Long in length, alter to fit</li> 
    <li> Model wears an IT 48\r</li> 
    <li> Model measures: waist size 32, height 6\'1"/ 185cm\r</li>'. 

내 각도 응용 프로그램에이 데이터를로드하려고

, 그것은합니다 ( <li>이 구문 분석되지 않습니다 즉) 텍스트로 렌더링됩니다 예를 들어

. 이 문제는 보안상의 이유로 발생하는 것으로 알고 있지만 해결 방법이 있습니까?

+1

중복 가능성 [뷰에 삽입 HTML 사용 AngularJS와 (http://stackoverflow.com/questions/9381926/insert-html-into-view-using-angularjs) –

+0

보세요 : http://docs.angularjs.org/api/ng.$compile – Cherniv

+0

보다 완벽한 답변을 찾았습니다 : [link] (http://stackoverflow.com/questions/9381926/insert- html-into-view-using-angularjs) – gianlucabr

답변

9

으로 βdamax를 여기 말했다 : https://stackoverflow.com/a/11640420/769083

<div ng-bind-html-unsafe="post.size_description"></div> 
+4

ng-bind-html-unsafe는 Angular 1.2 이후 감가 상각되었습니다. http://stackoverflow.com/questions/9381926/insert-html-into-view-using-angularjs를 참조하십시오. –

관련 문제