AngularJs的ReferenceError:角没有定义 [英] AngularJs ReferenceError: angular is not defined

查看:423
本文介绍了AngularJs的ReferenceError:角没有定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试添加自定义过滤器,但如果我用下面的code:

I trying to add a custom filter, but if I use the following code:

angular.module('myApp',[]).filter('startFrom', function() {
    return function(input, start) {
        start = +start; //parse to int
        return input.slice(start);
    }
});

但是,如果我这样做,我得到的ReferenceError:角没有定义,在萤火

But if I do so, I get: "ReferenceError: angular is not defined" in firebug.

应用程序的其余部分是工作的罚款,我使用的NG-应用在标签div的不是HTML标签和<一个href=\"https://ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular.js\">https://ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular.js

The rest of application is working fine, I am using ng-app in a tag div not in tag html, and https://ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular.js

推荐答案

井的方式这是一个单页的应用程序,所用的解决方案是:

Well in the way this is a single page application, the solution used was:

加载使用AJAX的内容,像任何其他控制器,然后拨打:

load the content with AJAX, like any other controller, and then call:

angular.bootstrap($('#your_div_loaded_in_ajax'),["myApp","other_module"]);

干杯

这篇关于AngularJs的ReferenceError:角没有定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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