Node JS and Grunt must installed on your development machine. You will also need to install globally several plugin.
npm install -g grunt-cli
bower install
npm install
grunt watch
: Allow you to develop as you go.grunt build
: Build a dist folder containing dev contents.
#Notes#
- Module oriented architecture
#Architecture#
- config
- grunt
|- gruntConfig.coffee
- src
|- app
|- page
|- _page.js (module definition and config)
|- pageStates.js (ui-router states for this app module)
|- pageIndexCtrl.js (ctrl linked to index state)
|- pageIndex.tpl.html (tpl linked to index state)
|- assets
|- modules
|- scss
|- views
|- index.html
#Workflow#
Add a new app module
- Create a folder
app/dummy
. - Create an angular module declartion file
app/dummy/_dummy.js
, and inject it inapp/_app.js
. - Create a ui-router state files
app/dummy/dummyStates.js
. - Edit
app/dummy/dummyStates.js
and add as state as you want.
.state('dummy', {
url: '/dummy',
views: {
'main': {
'templateUrl': 'app/dummy/dummyIndex.tpl.html',
'controller': 'dummyIndexCtrl'
}
})
.state('dummy.edit', {
url: '/dummy/edit/:id',
views: {
'main': {
'templateUrl': 'app/dummy/dummyEdit.tpl.html',
'controller': 'dummyEditCtrl'
}
})
- If you need to create a reusable directive, you can create it in
app/views
, and inject it in themodules/_modules.js
module declaration. - If you want to create a specific directive for this module you can drop it in
app/views/dummy
folder, and inject it in theviews/_views.js
module declaration.
Rules :
- If a directive is closely linked to a specific service, it should be moved in
app/modules/myModule
, because it's not anymore a simple "view" directive - DO NOT create more than necessary in
app/dummy
. Only_dummy.js
,dummyState.js
and adummy<*>Ctrl.js
/dummy<*>.tpl.html
by state defined in thedummyState.js