Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有办法在 Angular 表达式中访问全局 JavaScript 变量?如:
ng-disabled="{someJavascriptVariableHere}"
Angular 表达式只会查找 $scope 上的变量,但如果您在控制器中执行以下操作:
// assumes someJavascriptVariableHere exists in the global scope $scope.someJavascriptVariableHere = someJavascriptVariableHere;
然后你就可以访问它了。