Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/22.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+;让内容和表达式的json字符串变得栩栩如生_Angularjs - Fatal编程技术网

Angularjs+;让内容和表达式的json字符串变得栩栩如生

Angularjs+;让内容和表达式的json字符串变得栩栩如生,angularjs,Angularjs,我正在努力将一个字符串从服务器放入我的angularjs应用程序中 从服务器: { "content": "<div><h1 ng-bind='model.title.text'></h1></div>", "model": "title": { "text": "yeah, its working" } } 具有范围访问权限的HTML: 结果 sourcecode{{model.title.text}-看起来正常 可视化{{model

我正在努力将一个字符串从服务器放入我的angularjs应用程序中

从服务器:

{ 
  "content": "<div><h1 ng-bind='model.title.text'></h1></div>",
  "model": "title": { "text": "yeah, its working" }
}
具有范围访问权限的HTML:

结果 sourcecode
{{model.title.text}
-看起来正常 可视化
{{model.title.text}
-缺少解析或插值或其他内容。表达式没有得到计算


我想我可能需要一个指针:)

trustAsHtml
ng bind html
不编译html。因此,在尝试时不能在html中使用角度指令。如果服务器上有模板,最好使用
ng include
。感谢您的回复!我会试试的。这个效果很好。再次感谢!
$scope.model = data.data.model;
$scope.content = $sce.trustAsHtml(data.data.content)