Controller not a function, got undefined, while defining controllers globally

后端 未结 14 1763
感动是毒
感动是毒 2020-11-22 00:22

I am writing a sample application using angularjs. i got an error mentioned below on chrome browser.

Error is

Error: [ng:areq] http://errors.

14条回答
  •  隐瞒了意图╮
    2020-11-22 01:02

    I just migrate to angular 1.3.3 and I found that If I had multiple controllers in different files when app is override and I lost first declared containers.

    I don't know if is a good practise, but maybe can be helpful for another one.

    var app = app;
    if(!app) {
        app = angular.module('web', ['ui.bootstrap']);
    }
    app.controller('SearchCtrl', SearchCtrl);
    

提交回复
热议问题