如果我有$scope
$scope.Pages = [
$sce.trustAsHtml('<div class="col-sm-12" style="height:3vh;background-color:#adb5b9;"><a class="DeletePage" onclick="DeletePage()">x</a></div><div class="col-sm-12 Text"><p class="Paragraph" contenteditable="true">Write Your Text Here</p></div>'),
$sce.trustAsHtml('<div class="col-sm-12" style="height:3vh;background-color:#adb5b9;"><a class="DeletePage" ng-click="DeletePage($index)">x</a></div><div class="col-sm-12 Text"><p class="Paragraph" contenteditable="true">Write Your Text Here</p></div>')
];
如何删除
的对象$sce.trustAsHtml('<div class="col-sm-12" style="height:3vh;background-color:#adb5b9;"><a class="DeletePage" ng-click="DeletePage($index)">x</a></div><div class="col-sm-12 Text"><p class="Paragraph" contenteditable="true">Write Your Text Here</p></div>')
表单$scope.Pages
我也想访问
$sce.trustAsHtml('<div class="col-sm-12" style="height:3vh;background-color:#adb5b9;"><a class="DeletePage" ng-click="DeletePage($index)">x</a></div><div class="col-sm-12 Text"><p class="Paragraph" contenteditable="true">Write Your Text Here</p></div>')
在HTML
答案 0 :(得分:0)
var VisualEditor = angular.module("VisualEditor", ["ngSanitize"]);
VisualEditor.controller('VisualEditorController', function($scope, $sce) {
$scope.Pages = [
$sce.trustAsHtml('<div class="col-sm-12" style="height:3vh;background-color:#adb5b9;"><a class="DeletePage" onclick="DeletePage($index)">x</a></div><div class="col-sm-12 Text"><p class="Paragraph" contenteditable="true">Write Your Text Here</p></div>'),
$sce.trustAsHtml('<div class="col-sm-12" style="height:3vh;background-color:#adb5b9;"><a class="DeletePage" ng-click="DeletePage($index)">x</a></div><div class="col-sm-12 Text"><p class="Paragraph" contenteditable="true">Write Your Text Here</p></div>')
];
$scope.DeletePage = function(index){
$scope.Pages.splice(index, 1);
}
});
&#13;
<div class="row" ng-repeat="pg in Pages track by $index">
<div class="SinglePage" ng-bind-html="pg">
</div>
</div>
&#13;