pbastowski / angular2-now

Angular 2 @Component syntax for Angular 1 apps
MIT License
145 stars 15 forks source link

Abstract state bug #23

Closed rvboris closed 9 years ago

rvboris commented 9 years ago

Strange bug when i creating abstract state not from bootstrap function, template is not showing, if i add templateUrl to @State it's work, but scope vars is broken

Example http://plnkr.co/edit/74WX9lcXLOVSpEiG4wwU?p=preview

pbastowski commented 9 years ago

Could you provide more detail. Which JS file are you referring to and what line number? What have you changed in the code and/or template? etc Then I can help you :)

pbastowski commented 9 years ago

OK, I just saw your new files.

Any reason you are using an abstract state in testwrap?

Abstract states are normally used for setting up globals, configuring stuff, etc. Not normally used for displaying components. If I remove abstract:true from your code then the templates do display. Is this what you were after?

rvboris commented 9 years ago

I using abstract state for display page layout, like header, footer etc and setup some globals. You propose on each page to create the same components?

pbastowski commented 9 years ago

I'm not proposing anything like that. I'm just saying that your use of on abstract state may not be appropriate for what you want to achieve.

Have a look at the link below and let me know if this is the result you are after:

http://plnkr.co/edit/aTuyJsmb1pG10MVmmP9n?p=preview

rvboris commented 9 years ago

Yes this is exactly what i need! I never seen xabstract param before

pbastowski commented 9 years ago

xbstract does not exist :) I use x sometimes to "comment out" a parameter temporarily when I don't want it there.

Here is a version with out the xabstract parameter: http://plnkr.co/edit/aTuyJsmb1pG10MVmmP9n?p=preview

rvboris commented 9 years ago

:) But now i have direct access to testwrap without child state (it can be empty page with header/footer)

pbastowski commented 9 years ago

Yeah. That looks like a missing feature. I will look into it again later today.

pbastowski commented 9 years ago

I have fixed the angular2-now.js file in the plunker and it now works as expected with your "testwrap" as an abstract state. This means that "testwrap" will provide a template for it's child state "test", but can not itself be activated directly.

http://plnkr.co/edit/aTuyJsmb1pG10MVmmP9n?p=preview

I will do some more testing and when I'm satisfied that it's good I'll push it to github.

rvboris commented 9 years ago

working as I expected, thanks

pbastowski commented 9 years ago

OK, I'm closing this then.