0
Я новичок в угловой и я пытался создать экземпляр угловой модуль с firebase, но он продолжает давать мне:Угловой модуль не загружается с firebase
Не удалось создать экземпляр модуля MYAPP из-за:
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.
Вот мой app.js:
var app = angular.module('myApp',[]);
app.controller('myController', function($scope){
$scope.names = "Coder01";
});
Html:
<!DOCTYPE html>
<html ng-app='myApp'>
<head>
<meta charset="utf-8">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.0-beta.2/angular.js"></script>
<script src="https://www.gstatic.com/firebasejs/live/3.0/firebase.js"></script>
<script>
var config = {
apiKey: "AIzaSyBTY8XluWdgHFadZLwhlCiD5aupBBTkezU",
authDomain: "chatroom-60d2f.firebaseapp.com",
databaseURL: "https://chatroom-60d2f.firebaseio.com",
storageBucket: "chatroom-60d2f.appspot.com",
};
firebase.initializeApp(config);
</script>
<script src="js/app.js"></script>
<title>Welcome to ChatRoom</title>
</head>
<body ng-controller="myController">
<p>Input something in the input box:</p>
<p>Name : <input type="text" ng-model="names" placeholder="Enter name here"></p>
<h1>Hello {{names}}</h1>
</body>
</html>
Вот все мои ошибки:
VM3476:5 Uncaught TypeError: Cannot read property 'removeAttribute' of null(anonymous function) @ VM3310:5(anonymous function) @ VM3310:20
app.js:1 Uncaught SyntaxError: Unexpected token <
angular.js:68 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.
VM3400:5 Uncaught TypeError: Cannot read property 'removeAttribute' of null
Не совсем уверен, что может быть ошибка, которую вы инициализации '' firebase' до JS/app.js'. Попробуйте поместить блок сценария «firebase» после включения js/app.js. Еще лучше, вы можете попробовать поставить этот код в самом контроллере – Vasseurth