如何运行AngularJS例子 [英] How to run AngularJS example

查看:85
本文介绍了如何运行AngularJS例子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经做了如下描述: http://docs.angularjs.org/tutorial/step_00 ,但不能运行phonecat例如为AngularJS。它运行像一堆的HTML文件。例如,应用程序/索引async.html页给我下在Chrome的控制台错误:

 未捕获的错误:无模块:对myApp

此文件包含

  angular.bootstrap(文件,['对myApp']);


解决方案

在引导部分需要你白手创业的元素加载之后被调用。您可以把引导code。在HTML的结束,也可以使用现成的东西像文档从JQuery的。

I've done as described here: http://docs.angularjs.org/tutorial/step_00 but can't run the phonecat example as AngularJS. It runs like a bunch of html files. For example, the app/index-async.html page gives me following error in Chrome's console:

Uncaught Error: No module: myApp

This file contains

angular.bootstrap(document, ['myApp']);

解决方案

The bootstrap part needs to be called after the element you're bootstrapping to is loaded. You can either put the bootstrap code at the end of your html, or you can use something like document ready from JQuery.

这篇关于如何运行AngularJS例子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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