Closed prashid closed 11 years ago
I am not sure i understand what you are trying to do. But if you want to load your angularjs views as html file then check this issue: https://github.com/fnakstad/angular-client-side-auth/issues/13
Thanks for the reply. That #13 issue is what I want to achieve. Actually I want all my views as HTML. You suggested in #13 issue as below
Change the "view engine" setting on line 10 in the server.js file to html instead of jade. Can you suggest me what to do here please?
Hello prashid!
I found a fairly easy way of having both Jade and HTML side by side. in server.js, just add app.engine('html', require('jade').renderFile);
above the app.set('view engine', 'jade');
statement. Then you can create and retrieve html views you put in your views folder. Just make sure that you tack on ".html" to the URL when fetching them.
Let me know how it goes.
Oh, and check out Express' documentation for details on how their view engine system works: http://expressjs.com/api.html#app.engine
Did you figure this one out prashid? I'll go ahead and close this issue, but feel free to reopen it if you're still having trouble.
thanks for this info, i'm looking at your great project and this explanation will really help me adapt it for my use!
Happy to hear that Jason :) Feel free to post an issue if you run into any trouble!
Hi, Your application is using Jade engine which is working fine. I was looking for a solution to use same app work with angularjs templating and routing. Made all the necessary changes except boiled down to one problem in routes.js which handles routing path: '/*' & path: '/partials'. I explain that in 2 parts.
Part 1 :
In below code http://localhost:3000/ trigger path: '/*' route and do the proper cookie setting which is fine after that need to redirect like res.redirect('/') which result redirected to /login. Now read Part 2 below.
Part 2:
After Part 1, first time path: '/' route is triggered. After that path: '/partials' is called for every link on the tab to render pages. path: '/partials' is MUST route to stop triggering path: '/' route.
Question : What should be in response in the below route because I can not use res.render(requestedView) as my pages are .html and if I use redirect(req.url) that creates loop?
Question: I even unable to hit path: '/partials' and always trigger path: '/*'. So what to do.?
{ path: '/partials', httpMethod: 'GET', middleware: [function (req, res) { var requestedView = path.join('./', req.url); res.render(requestedView); }], accessLevel: accessLevels.public }
I will be grateful if you help.