There are lots of things that have tripped me up with Angular. This post is intended to be a list of all of the things that have tripped me up, with relevant links
General Gotchas
$http GET requires a data property for the content-type
header to be sent
This won’t send a content-type
header with the GET request:1
$http({url: '/something', method: 'GET'})
But this will:1
$http({url: '/something', method: 'GET', data: ''})
IE8-specific Gotchas
Specifying directives as elements
You can’t declare a directive as an element in IE8.
1 | <!-- This won't work in IE8--> |
Whitespace in transcluded content
This won’t work in IE8:1
2
3<div your-custom-directive-which-transcludes-content>
<span>There’s whitespace before this span but it looks nicely formatted in the editor</span>
</div>
Instead, you need to do make sure there is no whitespace surrounding the content:1
<div your-custom-directive-which-transcludes-content><span>My content</span></div>
See StackOverflow for more details.