Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 错误:[$injector:modulerr]未能实例化模块应用程序_Angularjs_Codemirror - Fatal编程技术网

Angularjs 错误:[$injector:modulerr]未能实例化模块应用程序

Angularjs 错误:[$injector:modulerr]未能实例化模块应用程序,angularjs,codemirror,Angularjs,Codemirror,我有这个错误,我不知道如何解决它们,如果你能帮助我的话 我的网页html如下 <html ng-app="app"> ... <div ng-controller="codeCtrl"> <textarea ui-codemirror ng-model="code">{{ code }}</textarea> </div> 您的页面上似乎没有包含依赖项[ui],并且没有实例化该依赖项, 此外,当您想要编写控制器

我有这个错误,我不知道如何解决它们,如果你能帮助我的话 我的网页html如下

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

您的页面上似乎没有包含依赖项
[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);
函数codeCtrl($scope){
$scope.code='HTML示例/title>/head>body>缩进尝试“照我的意思做”//em>…但可能与您的样式不匹配';
};
myApp.controller('codeTRL',codeTRL);

我没有在html页面中包含js脚本, 我建议使用['ui.codemirr'],而不是['ui']


感谢您的回答

什么是
[ui]
模块?您确定它可用吗?另外,您是否将这些模块包括在
index.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
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);