मैं कोणीय ट्यूटोरियल पर काम कर रहा हूं और मुझे शुरुआत में कोई समस्या है। लोड हो रहा है myApp मॉड्यूल त्रुटि फेंकता है। जैसा कि ट्यूटोरियल में बताया गया है, यह नियंत्रक बनाने के तीन तरीकों में से एक होना चाहिए।
यहाँ ट्यूटोरियल से प्रिंट स्क्रीन है मैं पर काम कर रहा हूँ: असहज त्रुटि: मॉड्यूल 'myApp' उपलब्ध नहीं है! (AngularJS)
जब मैं वेब पेज को ताज़ा मैं क्रोम कंसोल में इस त्रुटि मिलती है:
Uncaught Error: [$injector:modulerr] Failed to instantiate module myApp due to:
Error: [$injector:nomod] Module 'myApp' 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.
यह है मेरी HTML फ़ाइल
<html ng-app="myApp">
<head>
</head>
<body>
<h1>Hello world!</h1>
<div ng-controller="MainController">
{{ 2+2 }}
<br>
{{ val }}
</div>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.js"></script>
<script src="app.js">
</body>
</html>
यह मेरी app.js फ़ाइल है
var myApp = angular.module('myApp', []);
var MainController = function($scope){
$scope.val = "Main controller variable value"
}
तो मेरी समस्या क्या है? मेरे द्वारा इसका निर्धारण नहीं किया जा सकता।
अग्रिम
अच्छी आंखें .. +1 सर –
आप सही हैं! वास्तव में अच्छी आंखें .. धन्यवाद! –
:) धन्यवाद दोस्तों .. – PSL