所以我建立了一个网站,我希望将其他 .html 文件动态加载到 div 中。每个 .html 文件都包含一些内容,但 1 个 .html 文件包含自己的 angularjs 指令。
我正在使用ng-bind-html和$scope.content = $sce.trustAsHtml(data); 但我发现这会打印出 html raw (不处理任何角度指令)。
我尝试使用各种解决堆栈溢出的解决方案,但没有一个对我有用。
网站:http ://algorithmictrading.azurewebsites.net/
App.js:http ://algorithmictrading.azurewebsites.net/js/app.js
正在加载的 .html 页面示例:http: //algorithmictrading.azurewebsites.net/includes/home.html http://algorithmictrading.azurewebsites.net/includes/about_us.html
.html 包含角度指令的页面:http: //algorithmictrading.azurewebsites.net/includes/download.html
如您所见,如果您导航到网站并单击“下载”选项卡,则会加载内容,但不会处理下拉菜单中的角度。我添加的测试按钮也应该产生一个警告框。
现在,代码基于这个线程: 在 Angular js 中的 $sce.trustAsHtml() 字符串中调用函数
谢谢!