-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(gen): Support for server rendering and Angular's HTML5 mode
Server now uses EJS rendering to serve html views. New structure should allow Jade support later on. Additionally, HTML5 mode is now supported. All un-specified server routes now redirect to index so the angular routing system handles them. BREAKING CHANGE: angular-fullstack:route and angular-fullstack:view will now generate views and routes in the views/partials folder. For existing projects: Please install generator-angular and use it's subgenerators for creating routes and views. They are exactly the same as the generators that you have been using. Example usage: yo angular:route helloworld. For New projects: Continue to use angular-fullstack route and view subgenerators. The reason for this change in folder structure was to support server page rendering. Closes #18, #17
- Loading branch information
Showing
15 changed files
with
103 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
'use strict' | ||
|
||
angular.module('<%= scriptAppName %>', [<%= angularModules %>]) | ||
.config ['$routeProvider', ($routeProvider) -> | ||
.config ['$routeProvider', '$locationProvider', ($routeProvider, $locationProvider) -> | ||
$routeProvider | ||
.when '/', | ||
templateUrl: 'views/main.html' | ||
controller: 'MainCtrl' | ||
.otherwise | ||
redirectTo: '/' | ||
$locationProvider.html5Mode(true) | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
'use strict' | ||
|
||
angular.module('<%= scriptAppName %>', [<%= angularModules %>]) | ||
.config ($routeProvider) -> | ||
.config ($routeProvider, $locationProvider) -> | ||
$routeProvider | ||
.when '/', | ||
templateUrl: 'views/main.html' | ||
controller: 'MainCtrl' | ||
.otherwise | ||
redirectTo: '/' | ||
$locationProvider.html5Mode(true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
'use strict'; | ||
|
||
var path = require('path'); | ||
|
||
exports.partials = function(req, res) { | ||
var requestedView = path.join('./', req.url); | ||
res.render(requestedView, function(err, html) { | ||
if(err) { | ||
res.render('404'); | ||
} else { | ||
res.send(html); | ||
} | ||
}); | ||
}; | ||
|
||
exports.index = function(req, res) { | ||
res.render('index'); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
'use strict'; | ||
|
||
angular.module('<%= scriptAppName %>', [<%= angularModules %>]) | ||
.config(['$routeProvider', function ($routeProvider) { | ||
.config(['$routeProvider', '$locationProvider', function ($routeProvider, $locationProvider) { | ||
$routeProvider | ||
.when('/', { | ||
templateUrl: 'views/main.html', | ||
templateUrl: 'partials/main.html', | ||
controller: 'MainCtrl' | ||
}) | ||
.otherwise({ | ||
redirectTo: '/' | ||
}); | ||
$locationProvider.html5Mode(true); | ||
}]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
'use strict'; | ||
|
||
angular.module('<%= scriptAppName %>', [<%= angularModules %>]) | ||
.config(function ($routeProvider) { | ||
.config(function ($routeProvider, $locationProvider) { | ||
$routeProvider | ||
.when('/', { | ||
templateUrl: 'views/main.html', | ||
templateUrl: 'partials/main.html', | ||
controller: 'MainCtrl' | ||
}) | ||
.otherwise({ | ||
redirectTo: '/' | ||
}); | ||
$locationProvider.html5Mode(true); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters