I'm currently building a portfolio site for our company in AngularJS with UI-router. We're using the HTML5 url scheme, and I've got the standard .htaccess in place to rewrite requests to index.html ( though in production this will be running on a .NET server ).
Some sections of the site are made up of freeform html documents rendered via ng-include directives, to allow our developers and designers the maximum freedom to create some pages however they want - for example client case studies that may warrant quite different layouts and media.
The pages are all loaded via a slug parameter to a state, something like '/work/some-case-study-name'. The state handler then takes the slug parameter and supplies that as url to an html file for the ng-include to load. For example the url above would resolve to '/partials/case-studies/some-case-study-name.html'. This is all loaded into a directive.
At the moment, it seems to be impossible to catch a mis-typed slug url though. It appears that either through the .htaccess setup or angular's routing system, when ng-include fails to find the requested html file, it always returns 200OK and just renders the route of the site.
Does anyone know of a way to make ng-include return a 404 if the document it's trying to load does not exist?
thanks!