Build Angular.js apps in a structured (component-based) way.
.env
file)icons
directory, automatically creates iconfont)sudo npm install slush -g
sudo npm install slush-angular-components -g
slush angular-components
npm install
npm run dev
Components are small, reusable parts of your application.
All component files DO NOT need angular module definition, it happens for you!!
So you don't ever have to write this:
angular.module('myApp').directive('myAwesomeDirective', myAwesomeDirective);
angular.module('myApp').controller('MyAwesomeController', MyAwesomeController);
Instead, the type is defined in the filename i.e. dashboard.directive.js
, dashboard.controller.js
I fucking hated the time it took to create the files alone, then always the same code repeating, fuck that shit, so again: declare the type in the file.
file name: dashboard.directive.js
function dashboard () {
return {
restrict: 'E',
templateUrl: 'dashboard/dashboard.html',
controller: 'DashboardController',
controllerAs: 'vm',
bindToController: true,
scope: {}
}
}
file name: dashboard.controller.js
function DashboardController () {
var vm = this;
}
file name: users.factory.js
function users ($q, $http) {
var getUser = function (userId) {
return $http.get('/users/' + userId);
}
return {
getUser: getUser
}
}
check the demo content in the scaffolded version