I am trying to route using angular.js around the / parent root, which works if I use anchor links, etc. (the so-called routing processed exclusively from angular). For example, a link having href '/ parent / createstudent'. However, when I type this in the url line or when I update it when it is already in this place, it generates an error because the backend route has not yet been completed.
Thus, I tried to use the common path ('/ parent / *') in the expression, but this leads to an error when all my js and css are not readable. Does anyone know how to solve this?
My static file directory
public -> javascripts -> app.js -> angular.js -> stylesheets -> images
Error:
Resource interpreted as Script but transferred with MIME type text/html: "http://localhost:3000/parent/javascripts/jquery.js". home:1 Resource interpreted as Script but transferred with MIME type text/html: "http://localhost:3000/parent/javascripts/angular.js". home:1 Resource interpreted as Script but transferred with MIME type text/html: "http://localhost:3000/parent/javascripts/main.js". home:1 Uncaught SyntaxError: Unexpected token < jquery.js:1 Uncaught SyntaxError: Unexpected token < angular.js:1 Uncaught SyntaxError: Unexpected token <
Express
app.get('/parent', function(req, res) { res.render('main') }); app.get('/parent/*', function(req, res) { res.render('main') });
Angular routing (I declare controllers in the view itself)
var app = angular.module('app', []).config(function($routeProvider, $locationProvider) { $locationProvider.html5Mode(true); $routeProvider.when('/parent/login', { templateUrl: '../templates/login.html' }). when('/parent/home', { templateUrl: '../templates/home.html' }). otherwise( { redirectTo: '/parent' }) })
source share