Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Awesome! #1

Open
Urigo opened this issue Apr 9, 2016 · 4 comments
Open

Awesome! #1

Urigo opened this issue Apr 9, 2016 · 4 comments

Comments

@Urigo
Copy link

Urigo commented Apr 9, 2016

This is a great thing to have.
The idea came from this PR but then I've talked about it with @kamilkisiela to also get the actual template from there.

Do you think it would be possible to get a PR that does both the current caching logic and the export logic?

@pbastowski
Copy link
Owner

My idea to do this actually came from the aurelia-meteor package that we talked about many months ago and my angular2 package for Meteor. I never saw that PR you referenced. However, it is good to see that many people think in the same ways :)

And yes, it is possible to do both at the same time. That is, to push the HTML into Angular's template cache and in the same module export the HTML. But, is it a good idea? Perhaps sometimes we don't want to push the code to Angular's cache. I read that templateUrl referenced templates are always loaded async, whereas inline template are always sync. Also, if I'm importing the HTML, then I don't want to also have it automaticaly pushed to Angular's templateCache. That would double up on the HTML stored in memory.

I am leaning towards creating a separate package. Perhaps calling it template-modules or import-templates. Essentially, these exported templates have nothing to do with Angular. They just export HTML as "text", which can then be imported by any module for any purpose.

@Urigo
Copy link
Author

Urigo commented Apr 9, 2016

that would be great.
Might also worth checking how Blaze is doing it.
maybe instead of recommending people angular-templates we could recommend your general package that will be shared for all HTML users on Meteor (everyone but React?)

@pbastowski
Copy link
Owner

Sure, I am happy for you to do that, Uri.

There is one issue with the current implementation of angular-templates. It generates a "body.html" file when you meteor build, which includes the text of all your <body> tags. This is different to the output of blaze-html-templates, which includes the body section in the index.html file directly and does not output a body.html file at all.

The actual problem is that if you use meteor-build-client and then serve the app using some web server, like live-server for example, you get a blank page. It does not work at all until you add what's in the body.html file to the body section of index.html. Again, this problem only happens with angular-templates and not with blaze-html-templates. For the moment, I add an in-between step that merges the contents of body.html into index.html's body section. This fixes the problem.

I had a good look through the source of angular-templates, but can't find what causes the creation os a standalone body.html file, but haven't found the issue yet. Perhaps someone can help?

@trajano
Copy link

trajano commented Apr 24, 2016

I'm actually relying on the behavior that includes the <body> text of my index.html file which is usually where I do my main app.

<body data-ng-app="myApp" data-ng-strict-di="true">
   <div data-ui-view="root" data-autoscroll="false"></div>
</body>

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

No branches or pull requests

3 participants