Closed michaeljoser closed 10 years ago
You should create a backend to provide an API and use AngularJS service + connect it to the routes using the resolve property. This is more question for stackoverflow instead of here.
oups i probably phrased that question wrong... I am actually using angular-client-side-auth for my project... what i'm confused is why does /users give me the users in JSON format but the ones i declared in express server.js
app.get('/api/1/messages', function(req, res) { ...
...
...
those will result in Angular giving me a 404
[SOLVED]
found this in route.js
// User resource
{
path: '/users',
httpMethod: 'GET',
middleware: [UserCtrl.index],
accessLevel: accessLevels.admin
},
so i'm basically creating new resources/models/controllers to satisfy my API needs :)
Yep! You have to declare the the actual URL route on the server-side. If not it will be caught by a catchall route which will "delegate" the routing to the client-side Angular routing (from a server-side perspective it will just return the index site, which will cause Angular to check the route provided when it has been loaded). It works like this because I wanted pretty, "html5mode" url's on the client side :)
Hello,
I'm building an application where i would have API calls like this: /api/1/messages /api/1/message/1 /api/1/projects
but when i issue those calls in AngularJS using the $http.get command... seems like AngularJS is taking the request and showing me a 404 page and not passing the request to the server side.
what would be the best way to tackle that?