角度控制器功能未定义

时间:2018-06-28 05:12:40

标签: angularjs mean-stack

我尝试使用<div class="form-group col-md-4"> <label>Version</label> <input type="text" name="version" id="version" value=""> <label>Suggested version: <span style="color: darkblue">{{@suggested_version}}</span></label> </div> </div> <div class="row"> <div class="col-xs-12"> <div class="btn-group pull-right"> <button type="button" class="btn btn-primary btn-sm align-right" data-toggle="modal" data-target="#myModal">Regenerate</button> <div id="myModal" class="modal fade" role="dialog"> <div class="modal-dialog"> <!-- Modal content--> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">&times;</button> <h4 class="modal-title">Confirmation</h4> </div> <div class="modal-body"> <p>Do you want to change version to {{@version}}</p> </div> <div class="modal-footer"> <input type="submit" class="btn btn-primary" value="Regenerate"> <button type="button" class="btn btn-default" data-dismiss="modal">No</button> </div> </div> </div> </div> </div> 创建一个控制器。该控制器可以与其他现有控制器正常工作,但不能与我创建的新控制器正常工作,将不胜感激,谢谢。

  

angular.js:12808错误:[ng:areq]参数   'TestownerControllerController'不是函数,未定义   http://errors.angularjs.org/1.4.14/ng/areq?p0=TestownerControllerController&p1=not%20aNaNunction%2C%20got%20undefined

这是我的控制器代码

meanjs.org

1 个答案:

答案 0 :(得分:0)

在您的情况下,您错过了定义用户应用[]的{​​{1}}

angular.module('users')...:这是必需的,我们将其用于注入其他模块。

您还可以像这样在应用程序中设置配置:

[]

此配置可帮助您注册具有其他依赖项的模块。

app.config(["$controllerProvider", "$compileProvider", "$filterProvider", "$provide", function ($stateProvider, configs, $controllerProvider, $compileProvider, $filterProvider, $provide) {
app.controller = $controllerProvider.register;
app.directive = $compileProvider.register;
app.filter = $filterProvider.register;
app.factory = $provide.factory;
app.service = $provide.service;
app.constant = $provide.constant;
}]);