我正在尝试添加 <object></object>
使用 Controller 进入我的html。当我加载<div>
时或<p>
,它工作正常,但是当我添加 <object>
时它没有出现,也没有任何自定义属性。
HTML:
<html ng-app="myAngularSite">
...
...
<div ng-controller="MyController">
<div id="myloader" ng-bind-html="myObject"></div>
</div>
JS:
var app = angular.module('myAngularSite', ['ngRoute']);
angular.module('myAngularSite', ['ngSanitize'])
.controller('MyController', ['$scope',function($scope) {
$scope.myObject =
'<object id="my_object" data="mysite.html" width="99.5%" height="400px" style="overflow:auto;border:3px ridge gray"/>';
}]);
如何将自定义属性和对象添加到我的网站中?我注意到当我尝试加载 <div id"with_attribut></div>
时,属性不会出现具有属性,尽管 div 本身出现。
谢谢!
最佳答案
自定义指令可能是很好的解决方案,您始终可以添加更多自定义行为。使用 ngBindHtml 你将受到限制。这是可以帮助您的链接:
关于javascript - 使用 AngularJS Controller 添加具有自定义属性的 <object>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25311045/