SyntaxError: expected expression, got '<' on AngularJS route refresh

1.7k Views Asked by At

I am getting a

SyntaxError: expected expression, got '<'
when I refresh my AngularJS route with a URL parameter on the url. This happens when in HTML5 mode and the # is removed. I have routing for this in my .htaccess file to allow me to access any URL and have it routed to index.html. The error only occurs when I have a parameter on the end, for example:

.state('app.test', {
                url: "/service/:test",
                templateUrl: '/views/service.html'
            })

Going to /service/sampleText would result in the syntax error from above.

Thank you in advance for any assistance you can offer!

1

There are 1 best solutions below

0
On BEST ANSWER

I thought I'd put my solution to this issue up here, since it took me a bit of finagling to find.

I was able to move my script include line for my app.js file, which includes my routing $stateProvider, to the body tag from the head tag of my index.html file and that fixed it for me.