今天把用ionic做一个案例,和ionic示例项目差不多,只是用requirejs分离了controller,但是一直报错

Error: [ng:areq] Argument ‘AppCtrl’ is not a function, got undefined

define(function (require) {
'use strict';
var controllers = angular.module('starter.controllers', []);
controllers.controller('appCtrl',require('controllers/appController'));
controllers.controller('dashCtrl',require('controllers/dashController'));
controllers.controller('gameCtrl',require('controllers/gameController'));
controllers.controller('meCtrl',require('controllers/meController'));
controllers.controller('infoCtrl',require('controllers/infoController'));
controllers.controller('playListCtrl',require('controllers/playListController'));return controllers;
});

经过一番折腾还是没能解决。后来我细分析,我的控制器叫appCtrl,错误信息中怎么是AppCtrl,我试着将名称首字母大写,卧槽,居然通过了

define(function (require) {
'use strict';
var controllers = angular.module('starter.controllers', []);
controllers.controller('AppCtrl',require('controllers/appController'));
controllers.controller('DashCtrl',require('controllers/dashController'));
controllers.controller('GameCtrl',require('controllers/gameController'));
controllers.controller('MeCtrl',require('controllers/meController'));
controllers.controller('InfoCtrl',require('controllers/infoController'));
controllers.controller('PlayListCtrl',require('controllers/playListController'));
return controllers;
});

再在网上搜,原来 ionic 的 ui-router 是大小写敏感,这里定义的控制器名要与路由中定义的控制器名大小写一致

Error: [ng:areq] Argument ‘AppCtrl’ is not a function, got undefined的更多相关文章

  1. Error: [ng:areq] Argument 'xxxx' is not a function, got undefined

    "Error: [ng:areq] Argument 'keywords' is not a function, got undefined" 代码类似这样的: <div n ...

  2. 【AngularJs】---"Error: [ng:areq] Argument 'fn' is not a function, got undefined"

    项目中把controller.service抽取出来 一步一步没有报错 index那里加 <script src="js/controllers/XXController.js&quo ...

  3. Error: [ng:areq] Argument 'LoginCtrl' is not a function, got undefined

  4. [ng:areq] Argument 'XXXXCtrl' is not a function, got undefined

    angular.module('MyApp', []) 这里的[]重复了,以后引入新的controller.js文件会覆盖前面那个,所以此处的[]去掉 .controller('MyCtrl', fu ...

  5. Error: [ng:areq]

    错误描述:Error: [ng:areq] http://errors.angularjs.org/1.4.8/ng/areq?p0=HelloCtrl&p1=not%20a%20functi ...

  6. Argument 'xxx' is not a function, got undefined,初学Angular的第一个坑

    终于考完试了,在没更新的这一段时间里,一直都在忙于应付考试.不过在期间也是接触到不少好玩的东西,比如Html5的Canvas,我用lufylegend的Html5引擎做了个<看你有所色>的 ...

  7. angular Error: [ng:areq]

    在使用augularjs的时候,爆了个错误: 后来经过对比,原来是我的<html>标签多了点东西

  8. angular.min.js:118 Error: [ng:areq] http://errors.angularjs.org/1.5.8/ng/areq?

    1,错误如图所示 简单说下错误原因是:没有js没有注册进去. 解决方法: 1.看下index.html有没有引入你的js文件. 2.看下app.js有没有注册js,比如我这次就是这步没做好,合并代码时 ...

  9. AngularJS中angular.min.js:80 Error: [ng:areq] http://errors.angularjs.org/1.2.9/ng/areq

    报出来的时候,出现这种错误,是因为在引入控制器的时候没有引入成功,我遇到这个错误是在因为没有将父控制器引入到子控制器中.

随机推荐

  1. Node Sass does not yet support your current environment解决办法

    在React项目中,使用了sass.之前运行的好好的,今天突然报错,提示当前环境不支持sass模块,然后就百度了下,发现有相同问题的.原来问题是之前开发时node是6.x的版本,几天前更新到最新10. ...

  2. Mybaits

    1.Mybatis全注解形式  (在注解上不能直接使用动态Sql,必须要在前后面加上<script>SQL</script>标签,否则会报错): @Select("& ...

  3. docker 入门第一步

    docker 安装 利用yum 安装 yum 源更新到最新版本,命令: yum update 需要安装工具 net-tools 命令:yum  install -y net-tools 配置docke ...

  4. 给tomcat配置外部资源路径(应用场景:web项目访问图片视频等资源)

    对于一个web项目来说,除了文字之外,图片,视频等媒体元素也是其重要的组成部分.我们知道,web项目中如果用到大量的图片.视屏的资源,我们 通常的做法是只在数据库中存储图片.视频等资源的路径,web项 ...

  5. springmvc拦截器的简单了解

    1.定义一个拦截器 2.在springmvc.xml中配置拦截器. (1)拦截器拦截的请求是建立在前端控制器配置之下的,若DispatcherServlet拦截的是*.action,则拦截器即使配置 ...

  6. js中json的使用

  7. 移动端过禁止输入emoji表情实现方案

    最近手头上的项目有一个需求就是输入框不能输入表情,然后就各种在网上找资料,网上好多人给的方案是: str = str.replace(/\uD83C[\uDF00-\uDFFF]|\uD83D[\uD ...

  8. Kafka自带zookeeper报错INFO Got user-level KeeperException when processing xxx Error Path:/brokers Error:KeeperErrorCode = NodeExists for /brokers (org.apache.zookeeper.server.PrepRequestProcessor)

    问题描述: 按照kafka官方文档的操作步骤,解压kafka压缩包后.依次启动zookeeper,和kafka服务 kafka服务启动后,查看到zookeeper日志里有以下异常 问题原因及解决办法: ...

  9. mysql修改密码方法

    1. 修改密码有三种方法:1.1 ---->用mysqladmin修改密码格式:mysqladmin -u用户名 -p旧密码 password 新密码 例子:# mysqladmin -uroo ...

  10. python argparse(参数解析)模块学习(一)

    class ArgumentParser(_AttributeHolder, _ActionsContainer): """Object for parsing comm ...