Merhaba ve afedersiniz ingilizcem. Ben Açısal js (şu anda 1.4 sürümü ile öğrenme) için acemiyim ve böyle iki modülde başvurumu ayırmak istiyorum:Angular js içinde farklı dosyalarda birden çok modülle çalışma
Benim sorun budur
(function(){
var app = angular.module('store', ['store-products', 'ngAnimate', 'ui.bootstrap']);
app.controller('StoreController', function(){
...
});
app.controller('ReviewController', function(){
...
};
this.rateOnClick = function(){
...
};
this.addReview = function(product){
...
};
});
.
.
.
})();
app.js
products.js
(function(){
var app = angular.module('store-products', []);
app.directive('productTitle', function(){
...
});
app.directive('productPanels', function(){
...
});
})();
index.html
<html>
<head>
<title>My Angular App!</title>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.9/angular.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.9/angular-animate.js"></script>
<script src="http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-1.2.4.js"></script>
<link href="styles.css" rel="stylesheet">
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet">
<script src="app.js"></script>
<script src"products.js"></script>
...
</html>
Tüm dosyalarım aynı klasörde.
Uncaught Error: [$injector:modulerr] Failed to instantiate module store due to:
Error: [$injector:modulerr] Failed to instantiate module store-products due to:
Error: [$injector:nomod] Module 'store-products' 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.
dışarı someon rakam bu neden oluyor edilemez: app.js yüzden bildiğim kadarıyla gayet içerir anlıyorum ama yine de hata almaya, birincil modüldür?
Eğer uygulama adını demek istiyorsunuz:
böyle Sabit? –
Bu yardımcı olabilir: http://www.codeproject.com/Articles/862602/Define-multiple-Angular-apps-in-one-page –