Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Some small doc updates #7002

Closed
wants to merge 2 commits into from
Closed

Some small doc updates #7002

wants to merge 2 commits into from

Conversation

carver
Copy link
Contributor

@carver carver commented Apr 5, 2014

I'm new enough to angular that I'm not positive I got the $save().then() example right, so I would appreciate a second pair of eyes.

carver added 2 commits April 4, 2014 22:48
The doc now shows newCard.id is set only after the server responds,
since we should only `expect(newCard.id).toEqual(789)` after the promise is resolved.
@mary-poppins
Copy link

Thanks for the PR! Please check the items below to help us merge this faster. See the contributing docs for more information.

  • Uses the issue template (#7002)

If you need to make changes to your pull request, you can update the commit with git commit --amend.
Then, update the pull request with git push -f.

Thanks again for your help!

@petebacondarwin petebacondarwin self-assigned this Apr 5, 2014
// POST: /user/123/card {number:'0123', name:'Mike Smith'}
// server returns: {id:789, number:'0123', name: 'Mike Smith'};
expect(newCard.id).toEqual(789);
newCard.$save().then(function() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is wrong, instance actions won't create a new promise (it will still have the old promise), so this wouldn't wait for a response from the server, just the next tick.

@caitp caitp closed this in d845d8a Apr 5, 2014
caitp pushed a commit that referenced this pull request Apr 5, 2014
"submitting and issue" should be "submitting an issue"

Closes #7002
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants