by pyre · 12y ago · 0 comments
The deep-linking example comes across to me as an issue of setting up initial state. Loading those other routes first either loads data or modifies the state of the application in a way that is required to display that route.
(or the author doesn't understand the difference between example.com/path/to/route and example.com/#!/path/to/route, but seeing as it "works 50% of the time" it's probably not this)
> Loading those other routes first either loads data or modifies the state of the application in a way that is required to display that route
That should be a non-issue as far as I understand, because visiting a nested route causes the parent route code to be executed first. Hence, the confusion.
/users/
/users/15/
/users/15/photos/
Your router map probably looks like this: App.Router.map(function() {
this.route('index', { path: '/' });
this.resource('users', { path: '/users' }, function () {
this.route('index', { path: '/' });
this.route('show', { path: '/:user_id' });
this.route('photos', { path: '/:user_id/photos' });
});
});
This translates into a structure like: ApplicationRoute
IndexRoute
UserRoute
UsersIndexRoute
UserShowRoute
UserShowPhotosRoute
Note how all of those Users*Route classes are all siblings rather than in parent-child relationships. Also note that if you're sharing controllers, they won't pass through Route.setupController on the sibling routes because those routes aren't run.For example, "Silent Errors" is spot-on. One example of an error (technically Ember-Data, but they are pretty much joined at the hip):
1. Save data for a particular model.
2. The data actually gets sent to the API and saved.
3. The API returns the updated model data.
4. Ember.js fails to load the updated data.
Turns out that the model was created with `store.createRecord('ModelName')` instead of `store.createRecord('modelName')`. Adding the capitalization to the first letter failed to raise any errors and worked in all but one place in the code. This took me a couple of hours of basically debugging Ember-Data internals (and even thinking that I had found a bug in their data loading) to figure this out (which was also difficult since some of the key methods are only generated at run-time so it's difficult to search the codebase for them).$scope.myObj = {x: 2}; <div ng-bind="myObj.notHere"></div>
(forgive me if my syntax is off a bit, haven't written angular in awhile)
The example he gave is an object not having a properly on it that he's trying to access. Any javascript templating language will have this issue