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

Consider using a named ui-view #446

Closed
sgimeno opened this issue May 18, 2015 · 12 comments
Closed

Consider using a named ui-view #446

sgimeno opened this issue May 18, 2015 · 12 comments
Assignees

Comments

@sgimeno
Copy link

sgimeno commented May 18, 2015

First of all props to all maintainers for the great job on this angular module. I'm already using it in a couple of projects.

When writing a simple Angular web app to display ng-admin views as a "backoffice" for some data source I can't build other angular-ui-router ui-view's because ng-admin needs an unamed ui-view. Wouldn't be nice to be able to embed ng-admin views in a separated and named ui-view? Is there any other approaches I'm missing or is this out of the scope of the project?

So far I also found this article which encourages to use named ui-view's:
http://www.toptal.com/angular-js/top-18-most-common-angularjs-developer-mistakes#common-mistake-5-not-using-named-views-with-ui-router-for-power

@fzaninotto
Copy link
Member

Hi Sergio, and thanks for your feedback.

Yes, we are aware of this issue, and using a not-main view is indeed the solution. The only problem is that it would break existing applications.

I guess the best way (and the only BC way) would be to add a second parameter to the configure() call, specifying the named view to use (and it would be main by default).

@jpetitcolas any feedback on this?

@fzaninotto
Copy link
Member

Related to #335

@jpetitcolas
Copy link
Contributor

Passed parameter is already called config. I think we can simply add a new attribute uiViewName to this object, like we added the debug one recently.

Moreover, isn't the name main too generic? I would name it nga-main to prevent from collisions.

@fzaninotto
Copy link
Member

The main state replaces the default (nameless) ui-view. It's required for BC.

I'm +1 with your suggestion to add a parameter to the config object.

@sgimeno
Copy link
Author

sgimeno commented May 19, 2015

+1

@jpetitcolas jpetitcolas self-assigned this May 26, 2015
@alexdmejias
Copy link

+1

@Siafu
Copy link

Siafu commented Aug 28, 2015

So what's the work around ? My app is currently configured as follows.
app.js
image

admin.module
image

admin.route
image

admin html
image

@fzaninotto
Copy link
Member

No workaround for now, I think.

@ruben0909
Copy link

+1

1 similar comment
@giovanni-duarte
Copy link

+1

@JunkMyFunk
Copy link

+100

@jpetitcolas
Copy link
Contributor

It should be solved with last master version, which breaks backward compatibility to use a named view. You now have to name your admin div as:

<div ui-view="ng-admin">

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

8 participants