Skip to content

Commit

Permalink
routing good
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Sevilleja committed Jan 18, 2014
1 parent 36db1f6 commit 3acb3cc
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 15 deletions.
8 changes: 7 additions & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<base href="/">

<title>Starter Node and Angular</title>

<!-- CSS -->
Expand All @@ -21,7 +23,11 @@
<script src="js/appRoutes.js"></script>
<script src="js/app.js"></script>
</head>
<body ng-app="sampleApp">
<body ng-app="sampleApp" ng-controller="NerdController">

look at me

<div ng-view></div>

</body>
</html>
14 changes: 5 additions & 9 deletions public/js/appRoutes.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
angular.module('appRoutes').config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider) {
angular.module('appRoutes', []).config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider) {

$routeProvider

// home page
.when('/', {
templateUrl: 'views/home.html',
controller: 'NerdController'
templateUrl: 'views/home.html'
})

// sample page 1
.when('/sample1', {
templateUrl: 'views/sample1.html',
controller: 'NerdController'
templateUrl: 'views/sample1.html'
})

// sample page 2 (with parameters)
.when('/sample2:nerd_id', {
templateUrl: 'views/sample2.html',
controller: 'NerdController'
templateUrl: 'views/sample2.html'
});

// enable html5 history api
$locationProvider.html5mode(true);
$locationProvider.html5Mode(true);

}]);
7 changes: 4 additions & 3 deletions public/js/controllers/NerdCtrl.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
angular.module('NerdCtrl').controller('NerdController', ['$scope', function($scope) {
angular.module('NerdCtrl', []).controller('NerdController', function($scope) {

$scope.test = 'hello';
$scope.test = 'hello';
console.log('fuck');

}]);
});
4 changes: 2 additions & 2 deletions public/js/services/NerdService.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
angular.module('NerdService').factory('Nerd', ['$resource', function($resource) {
angular.module('NerdService', []).factory('Nerd', ['$resource', function($resource) {




}]);

0 comments on commit 3acb3cc

Please sign in to comment.