Skip to content
This repository has been archived by the owner on Feb 14, 2022. It is now read-only.

Commit

Permalink
user require syntax for partials
Browse files Browse the repository at this point in the history
  • Loading branch information
martell committed Jul 17, 2018
1 parent 35f2ea9 commit e7636fb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -32,7 +32,7 @@
"babel-preset-stage-2": "6.24.1",
"gh-pages": "1.2.0",
"node-sass": "4.9.0",
"parcel-bundler": "1.9.4",
"parcel-bundler": "1.9.8",
"rimraf": "2.6.2"
}
}
16 changes: 7 additions & 9 deletions src/js/app.js
@@ -1,5 +1,3 @@
const fs = require('fs');

//defines the AngularJS app as a module
angular
.module('westerosiApp', [
Expand All @@ -18,36 +16,36 @@ angular
$stateProvider
.state('about', {
url: '/about',
template: fs.readFileSync('./src/partials/about.html', 'utf8')
template: require('../partials/about.html')
})
.state('houses', {
url: '/houses',
template: fs.readFileSync('./src/partials/houseList.html', 'utf8'),
template: require('../partials/houseList.html'),
controller: 'HouseListCtrl'
})
.state('newHouse', {
url: '/newHouse',
template: fs.readFileSync('./src/partials/house.html', 'utf8'),
template: require('../partials/house.html'),
controller: 'NewHouseCtrl'
})
.state('houses.item', {
url: '/:item',
template: fs.readFileSync('./src/partials/house.html', 'utf8'),
template: require('../partials/house.html'),
controller: 'OneHouseCtrl'
})
.state('characters', {
url: '/characters',
template: fs.readFileSync('./src/partials/characterList.html', 'utf8'),
template: require('../partials/characterList.html'),
controller: 'CharacterListCtrl'
})
.state('newCharacter', {
url: '/newCharacter',
template: fs.readFileSync('./src/partials/character.html', 'utf8'),
template: require('../partials/character.html'),
controller: 'NewCharacterCtrl'
})
.state('characters.item', {
url: '/:item',
template: fs.readFileSync('./src/partials/character.html', 'utf8'),
template: require('../partials/character.html'),
controller: 'OneCharacterCtrl'
});
}
Expand Down
4 changes: 1 addition & 3 deletions src/js/directives.js
@@ -1,5 +1,3 @@
const fs = require('fs');

//defines the AngularJS app as a module
angular
.module('westerosiApp')
Expand All @@ -12,7 +10,7 @@ angular
.directive('navBar', function() {
return {
restrict: 'E',
template: fs.readFileSync('./src/partials/nav.html', 'utf8'),
template: require('../partials/nav.html'),
controller: ["$scope", "$location", function($scope, $location) {
$scope.isActive = function(route) {
return route === $location.path();
Expand Down

0 comments on commit e7636fb

Please sign in to comment.