Urigo / angular-blaze-template

Include Blaze templates in your angular-meteor application
https://atmospherejs.com/urigo/angular-blaze-template
MIT License
15 stars 6 forks source link

Does not work with meteor 1.3 #14

Open Undeadlol1 opened 8 years ago

Undeadlol1 commented 8 years ago

Obviously with new npm style import-export system previous versions of meteor packages do not work properly. Basically i get this error:

WARNING: Tried to load angular more than once. and: Uncaught TypeError: _angular2.default.module(...).component

Obviously "angular-blaze-template" imports meteor's angular before i manually import angular from npm.

Am i doing something wrong or should i just wait for the package updates?

dotansimha commented 8 years ago

Not so sure what you tried to do... Why "angular2" is in the error? This package is for Angular 1... can you please provide more info?

Undeadlol1 commented 8 years ago

@dotansimha I were also surprised by " _angular2" message. Although this error dissapeared when i upgraded Meteor's Angular to version 1.5. My quess is "_angular2.default.module(...)" is angular's way to report errors while encountering something not familiar. Like ".component" method, because there were no components prior v1.5 if i recall correctly. Just to clarify: i did not installed anything Angular 2 related ever, so i think error had nothing todo with Angular 2. About what i tried to do: angular-blaze-template package used to allow me not to worry about how login/signup pages looked in my apps. Whenever i used Bootstrap or Materializecss i could just install "useraccounts:bootstrap" or "useraccounts:materialize", then drop

<blaze-template name="loginButtons"></blaze-template> <blaze-template name="atForm"></blaze-template>

and i had beautifull prestyled and preconfigured templates. I do appreciate your work on 'accounts-ui-angular' @dotansimha but the reason i use Meteor is because it allows me to use alot existing solutions and i don't want to style login ui in every meteor project.

Urigo commented 8 years ago

@Undeadlol1 I think I understand the problem. angular-blaze-template is dependent on angular-with-blaze and angular-with-blaze is dependent on angular-meteor-data atmosphere package. So if you bring angular-meteor from npm, then you will get 2 Angular dependencies. It can be fixed like here I think - https://github.com/dotansimha/accounts-ui-angular/pull/7 I won't get to it today so I would love if you could try to fix it, test it and submit a pull request for that?

Undeadlol1 commented 8 years ago

@Urigo I tried to fix packages and make a pull request i really did. But i am weak and i bring shame on my family. The only input i can give after few experiments: even when multiple angular loads will be fixed, there still will be something which prevents angular-blaze-template to work. I have no idea what it is, and i hope i am wrong about it.

Undeadlol1 commented 8 years ago

Any updates on this?

trajano commented 8 years ago

FYI in case you're wondering, I am not going to create a PR for the above because this is a single file https://github.com/trajano/meteor-boilerplate/blob/angular/imports/ui/components/blazeTemplate.directive.js that is only viable on the client side. It would be better to repackage as an npm module, but that basically redoes almost everything on this project.

This works with useraccounts:unstyled and their atForm template. You can see how it is used on the branch https://github.com/trajano/meteor-boilerplate/tree/angular

However, if @Urigo is interested, please feel free to repackage it and put it on npm, it won't feel right if I did it.

trajano commented 8 years ago

After discussions with @sashko on https://forums.meteor.com/t/meteor-guide-methods/19662/23 I decided that I think it's okay that this is still an Atmosphere package, so I created a PR. Hopefully @Urigo can release it soon so I can take it out of https://github.com/trajano/meteor-boilerplate

trajano commented 8 years ago

@Undeadlol1 you can use my fork using git submodules. Do the following to enable it.

git submodule init 
mkdir packages
cd packages
git clone https://github.com/trajano/angular-blaze-template.git
cd ..
meteor add Urigo:angular-blaze-template
meteor update
leosco commented 8 years ago

This still doesn't work. I can confirm that the "tried to load angular more than once" warning appears consistently, and that I can't get my <blaze-template name="sAlert"></blaze-template> to work.

leosco commented 8 years ago

I'm guessing the reason that's happening is because the urigo:angular-blaze-template atmosphere package depends on various angular atmosphere packages, when we've already included angular from npm. Therefore, the client loader is trying to load both the atmosphere angular and npm angular. Though, I don't know how tricky it would be to migrate this package away from atmosphere to npm, considering it has to translate blaze to angular templates.