programing

각도 소독/ng-bind-html이 작동하지 않나요?

sourcejob 2023. 2. 23. 22:44
반응형

각도 소독/ng-bind-html이 작동하지 않나요?

리피터를 설치해서 HTML이 없는 한 데이터를 표시할 수 있습니다.

포함시켰습니다.angular-sanitize.js를 사용해 본 적이 있습니다.ng-bind-html

단, 스팬 내에서는 아무것도 표시되지 않고ng-bind-html기여하다.소독제가 효과가 없는 것 같아요

앱 종속성에 추가해야 한다고 읽었는데 어디에 추가해야 할지 모르겠어요.

나는 방금 각진 사이트의 튜터에게 작업하고 있었기 때문에, 그 시점에서는 매우 기본적인 컨트롤러만 셋업 되어 있습니다.

  1. angular-metricize.http://ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular-sanitize.js 를 포함해야 합니다.

  2. 모듈 의존관계에 'ngSanitize' 추가

    var myApp = angular.module('myApp', [ngSanitize]);

  3. 사용 안 함{{}}속성에

    <h1 ng-syslog-syslog="item.syslog"> </h1>

  4. 사용하지 않다

이에 대한 나의 해결책은 여기서 js 파일을 다운로드하는 것이었다.

http://ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular-sanitize.js

angular git repo에서 찾은 것을 사용하고 있었습니다.

저도 비슷한 문제를 겪었는데 저는 좀 이상했어요.입력 태그만 렌더링되지 않은 반면 다음을 포함한 모든 것은 모두 렌더링되지 않았습니다.

<h3></h3>
<em></em> 

그랬다. 몇 시간 후에 나는 깨달았어.

angular-sanitize.min.js 

추가할 필요가 있었습니다.

textAngular-sanitize.min.js

제 프로젝트에 투입된 태그가 작동하기 전에 말이죠.너무 아쉬웠기 때문에 비슷한 상황에 있는 사람에게 도움이 됐으면 좋겠습니다.

명령어를 사용할 때 이 문제가 발생했으며 솔루션이 코드에서 "바꾸기"를 사용하지 않았습니다.

templateUrl 뷰의 div에서 'ng-html-bind'가 사용되고 있었습니다.

appDirectives.directive('helpText', [function () {
return {
    restrict: 'E',
    //replace: true, // With this uncommented it does not work!
    scope: {
        displayText: '='
    },
    templateUrl: '/web/form/helptext',
    link: function (scope) {

    }

};
}]);

내 해결책은 세그레스판과는 정반대였다.그것은 Bower 버전의 Angular Sanitize를 사용하기 위해서였다.

bower install angular-sanitize

https://github.com/angular/bower-angular-sanitize

언급URL : https://stackoverflow.com/questions/14726938/angular-sanitize-ng-bind-html-not-working

반응형