在angular.bootstrap之前防止angular插值{{}}

Prevent angular from interpolation {{}} before angular.bootstrap

本文关键字:angular 插值 bootstrap      更新时间:2023-09-26

我在rootScope上暴露了一个变量,例如:

$rootScope.hey = 'hey';

并且我希望它以{{hey}}的形式显示在index.html上。然而,angular在调用angular.bootstrap之前将其替换为空值(这是在requirejs加载所有文件之后完成的)。

如何使它保持为{{hey}},直到调用angular.bootstrap。

注意:ng绑定将是一种解决方案,例如<div ng-bind="hey"></div>,但对于我的特定情况,我需要通过插值传递该值。

明白了。一个ng-app属性偷偷出现在index.html中。删除了它。