Looking to organize my Angular application with requirejs by separating controllers, services, and directives into different files. Hoping to achieve this structure:
src/
components/
Navigation/
index.js
module.js
NavigationController.js
NavigationService.js
In module.js, aiming for something like this:
define(['angular', './NavigationService', './NavigationController'], function (angular, NavigationService, NavigationController) {
'use strict';
return angular.module('Myapp.Navigation', [])
.controller('NavigationController', NavigationController)
.service('NavigationService', NavigationService)
});
Wanting to define the controller/service in separate js files.
Struggling with file definitions. Attempted syntax like this:
//NavigationService.js
define( function() {
this.doNavigation = function () {
console.log('I am navigating');
}
});
But encountering issues. Any experience with this structure using requirejs?
Thank you!