在模型angularJS中保存html标记
我想保存字符串在模型angularJS中保存html标记,angularjs,model,scope,tags,ng-repeat,Angularjs,Model,Scope,Tags,Ng Repeat,我想保存字符串 <div class="Page" contenteditable="true"></div> 在$scope.Pages=['']中 在angularJS 但是当我在HTML中使用ng repeat时,它显示为一个字符串。 我希望它是一个div而不是一个字符串。我认为应该使用ngBindHtml() 查看此链接也很有帮助:$sce请检查此链接 执行以下步骤1。下载angular-sanitize.js 2.代码 var-app=angular.m
<div class="Page" contenteditable="true"></div>
在$scope.Pages=['']中代码>
在angularJS
但是当我在HTML中使用ng repeat
时,它显示为一个字符串。
我希望它是一个div而不是一个字符串。我认为应该使用ngBindHtml()
查看此链接也很有帮助:$sce请检查此链接
执行以下步骤1。下载angular-sanitize.js
2.代码
var-app=angular.module('myApp',[“ngSanitize”]);
app.controller('myController',函数($scope){
$scope.html=['您的html代码',
"第二组",,
‘第三组’
];
});
你查过我的答案了吗?
var app = angular.module('myApp', ["ngSanitize"]);
app.controller('myController', function($scope) {
$scope.html = ['<div class="text-color">Your html code</div>',
'<div class="text-color">2nd div</div>',
'<div class="text-color">3rd div </div>'
];
});