I suugest you :
*js/app.js*
angular.module('myApp', [
'ngRoute',
'ngResource',
'*catalogService*'
// here are only modules you have defined
])...
*js/controllers.js*
var catalogCtrl = angular.module( '*myApp*');
catalogCtrl.controller('CatalogCtrl',[ '$scope', 'Catalog', function(
$scope, Catalog ){ $scope.catalog = Catalog.query(); $scope.orderProp =
'NAME'; } ]);
*js/services.js*
var catalogService = angular.module( 'catalogService', ['ngResource'] );
catalogService.factory( 'Catalog', ['$resource', function( $resource ) {
return $resource( '../api/index.cfm?f=app.catalog', {}, { query: { method:
'GET', params: {}, isArray: true } } ) }] );
*index.html*
*//includes the files below*
*js/controllers.js*
*js/services.js*
Le lundi 17 mars 2014 20:03:07 UTC+1, Noah Sepsenwol a écrit :
>
> To all who replied: thanks!
>
> index.html
>
> <html ng-app='myApp">
>
> but I coded:
>
> controllers;js
>
> angular.controller('MyController', [etc]) instead of
> angular.controller('myApp.MyController') [etc/])
>
> ... or service or filter. In other words, I did not reference the
> application namespace when instantiating modules.
>
>
>
> On Monday, March 17, 2014 11:12:51 AM UTC-4, Noah Sepsenwol wrote:
>>
>> Im gettting:
>>
>> Error: [$injector:nomod] Module 'myApp.services' is not available!
>>
>> *js/app.js*
>>
>> angular.module('myApp', [
>> 'ngRoute',
>> 'ngResource',
>> 'myApp.filters',
>> 'myApp.services',
>> 'myApp.directives',
>> 'myApp.controllers'
>> ])...
>>
>> (services.js below does load)
>>
>> *js/services.js*
>>
>> var catalogService = angular.module( 'catalogService', ['ngResource'] );
>> catalogService.factory( 'Catalog', ['$resource', function( $resource ) {
>> return $resource( '../api/index.cfm?f=app.catalog', {}, { query: { method:
>> 'GET', params: {}, isArray: true } } ) }] );
>>
>> *js/controllers.js*
>>
>> var catalogCtrl = angular.module( 'CatalogCntrl', [ 'catalogService' ]);
>> catalogCtrl.controller('CatalogCtrl',[ '$scope', 'Catalog', function(
>> $scope, Catalog ){ $scope.catalog = Catalog.query(); $scope.orderProp =
>> 'NAME'; } ]);
>>
>> Try as I might, I can't get past this error. Any ideas?
>>
>> Thanks,
>> Noah
>>
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.