angular.js - angular 模块的run方法如何使用

查看:127
本文介绍了angular.js - angular 模块的run方法如何使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

求解决:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script> 
</head>
<body>
    <div ng-app="myApp">{{test}}</div>
    <script>
        var app = angular.module("myApp", []);
        console.log(app);
        app.run(function($rootscope){$rootscope.test = 'hello test'});
    </script>
</body>
</html>

报错:

解决方案

$rootscope --> $rootScope. 你拼错了。。。

这篇关于angular.js - angular 模块的run方法如何使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆