Skip to content

Instantly share code, notes, and snippets.

@fernandofleury
Created August 5, 2014 15:03
Show Gist options
  • Save fernandofleury/500d98e172ffdcf983f9 to your computer and use it in GitHub Desktop.
Save fernandofleury/500d98e172ffdcf983f9 to your computer and use it in GitHub Desktop.
angular-browserify
(function(){
'use strict';
var router = require('./router/router.js'),
UsersViewCtrl = require('./controllers/users/view'),
UsersNewCtrl = require('./controllers/users/new'),
UsersEditCtrl = require('./controllers/users/edit'),
angular.module('app', ['ngRoute'])
.config(router)
.controller('UsersViewCtrl', UsersViewCtrl)
.controller('UsersNewCtrl', UsersNewCtrl)
.controller('UsersEditCtrl', UsersEditCtrl);
})();
// router
(function(){
'use strict';
module.exports = ['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider){
$routeProvider.when('/', {
templateUrl: 'views/users/view.html',
controller: 'UsersViewCtrl'
})
.when('/new', {
templateUrl: 'views/users/form.html',
controller: 'UsersNewCtrl'
})
.when('/edit/:user', {
templateUrl: 'views/users/form.html',
controller: 'UsersEditCtrl'
})
.otherwise({
redirectTo: '/'
});
$locationProvider.html5Mode(true);
}];
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment