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

fix(templateRequest): allow empty html template #9713

Closed
wants to merge 1 commit into from

Conversation

cmichal
Copy link
Contributor

@cmichal cmichal commented Oct 21, 2014

allow empty html template and not throw error

Closes #9581

@cmichal
Copy link
Contributor Author

cmichal commented Oct 21, 2014

ngEurope sprint with Vojta pull request.

@mary-poppins
Copy link

I'm sorry, but I wasn't able to verify your Contributor License Agreement (CLA) signature. CLA signature is required for any code contributions to AngularJS.

Please sign our CLA and ensure that the CLA signature email address and the email address in this PR's commits match.

If you signed the CLA as a corporation, please let us know the company's name.

Thanks a bunch!

PS: If you signed the CLA in the past then most likely the email addresses don't match. Please sign the CLA again or update the email address in the commit of this PR.
PS2: If you are a Googler, please sign the CLA as well to simplify the CLA verification process.

@cmichal cmichal force-pushed the emptyTemplate-fix branch 2 times, most recently from 466b09e to 50b6481 Compare October 21, 2014 11:07
@vojtajina vojtajina self-assigned this Oct 21, 2014
@@ -49,7 +49,7 @@ function $TemplateRequestProvider() {
return $http.get(tpl, httpOptions)
.then(function(response) {
var html = response.data;
if (!html || html.length === 0) {
if (!html && html !== '') {
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we instead use the status code (or $http(...).success().error())?

What happens if the request returns 404?
I think with this change, it will just act as if the template was empty.

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, that is already happening (I didn't see line 59).
So can't you just remove this condition?

allow empty html template and not throw error

Closes angular#9581
@vojtajina
Copy link
Contributor

Landed as 52ceec2
Thank you @cmichal !

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

Successfully merging this pull request may close these issues.

ngRroute : Empty html template returns "Failed to load template"
4 participants