Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在模型angularJS中保存html标记_Angularjs_Model_Scope_Tags_Ng Repeat - Fatal编程技术网

在模型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>'
                  ];
});