错误:[$injector:modulerr]实例化模块应用失败



我有这个错误,我不知道如何解决他们,如果你能帮助我我的页面html是跟随

<html ng-app="app">
...    
<div ng-controller="codeCtrl">
        <textarea ui-codemirror ng-model="code">{{ code }}</textarea>
</div>

和我的代码js如下:

        var myApp  = angular.module('app', ['ui']);
        myApp.value('ui.config', {
            codemirror: {
                lineNumbers: true,
                htmlMode: true,
                mode: "text/html",
                theme: "ambiance",
                indentWithTabs: false,
                readOnly: true,
                matchBrackets: true
            };                  
        });
        function codeCtrl($scope) {
            $scope.code= '<html style="color: green"> <head>    <title>HTML Example/title>  /head>    body> The indentation tries to be <em>somewhat &quot;do what  I mean&quot;/em>... but might not match your style.  </body> </html>';
        };

我接受这个错误

 Error: [$injector:modulerr] Failed to instantiate module app due to:
 [$injector:nomod] Module 'app' is not available! You either misspelled the module name    or forgot to load it. If registering a module ensure that you specify the dependencies as   the second argument.
  http://errors.angularjs.org/1.2.10/$injector/nomod?p0=app

我错过了包括js脚本在我的html页面,我建议使用[ui]。Codemirror ']代替['ui']

感谢您的回答

似乎依赖[ui]不包括在您的页面和实例化,另外,当你想写控制器时,你需要这样写:

function codeCtrl($scope) {
            $scope.code= '<html style="color: green"> <head>    <title>HTML Example/title>  /head>    body> The indentation tries to be <em>somewhat &quot;do what  I mean&quot;/em>... but might not match your style.  </body> </html>';
        };
myApp.controller('codeCtrl',codeCtrl);

最新更新