首页 > IT职业 > IT图书 > ASP.NET MVC下使用显示html
在Angularjs显示html文本,如果按照一般处理它。它只能页中显示没经解释文本。
在ASP.NET MVC添加一个控制器:
创建angularjs控制器:
pilotApp.controller('ShowHtmlCtrl', ['$scope','$sce', function ($scope, $sce) { var htmltext = "Hello Insus.NET"; $scope.Content = $sce.trustAsHtml(htmltext); }]);
Source Code
视图html:
Source Code
程序运行结果:
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/1551/viewspace-2806698/ ,如需转载,请注明出处,否则将追究法律责任。