angular / router

The Angular 1 Component Router
MIT License
665 stars 135 forks source link

bike shed: rename ng-viewport directive #264

Open btford opened 9 years ago

btford commented 9 years ago

Long story short: Angular 2 has a type of directive called "Viewport," which has a specific relationship to "View"s in Angular 2. Therefore, "viewport" is a bad name for "the thing that the router puts components into." It makes less sense to rename the "Viewport" type of directive in Angular 2 than to come up with a new name for the directive that the router uses.

There are a couple important criteria:

What should we call this? Here are a few options to get us started:

darcnite3000 commented 9 years ago

[sarcasm]

[/sarcasm]

:+1: to route-outlet it sounds more 'right' over content. Content seems too generic, and also feels like something needs to go into the tags, not that something is going into the tags later. Outlet implies something coming through, or attached, which is likely why it feels more right to me.

tommck commented 9 years ago

Component?

Sent by Outlookhttp://taps.io/outlookmobile for Android

On Wed, Apr 15, 2015 at 4:52 PM -0700, "Tristan Smith" notifications@github.com<mailto:notifications@github.com> wrote:

[sarcasm]

[:+1:] to route-outlet it sounds more 'right' over content. Content seems too generic, and also feels like something needs to go into the tags, not that something is going into the tags later. Outlet implies something coming through, or attached, which is likely why it feels more right to me.

Reply to this email directly or view it on GitHubhttps://github.com/angular/router/issues/264#issuecomment-93600525.

nunoviegas commented 9 years ago

I like the route- prefix, as it makes it clear that the directive is route related. maybe a sufix along the lines of a container:

<route-pod name="main"></route-pod>
<route-dock name="main"></route-dock>
jameskleeh commented 9 years ago

I like

<route-container name="main"></route-container>

AnthonyPAlicea commented 9 years ago

Too bad, viewport was a great name. I like

<route-content name="main"></route-content>

Very straightforward, though outside the 1.x 'ng-' standard. A few other suggestions:

<ng-component name="main"></ng-component>

<ng-route-component placeholder="main"></ng-route-component>

<route-component key="main"></route-component>

<ng-content name="main"></ng-content>

<ng-route-content name="main"></ng-route-content>

<route-placeholder name="main"></route-placeholder>

<ng-content-placeholder name="main"></ng-content-placeholder>

<route-component-placeholder name="main"></route-component-placeholder>

Looking very, very much forward to the release of this!

kpko commented 9 years ago

I think ng-viewport was a very great name, because "viewport" expresses what the component actually does. I think "route-content" doesn't really reflect this. I guess we can't go with router-viewport instead?

I like the idea @AnthonyPAlicea mentioned: "ng-content-placeholder".

uztha4c commented 9 years ago

I think that seems to make the most sense...it can be used in presentations/demos, in code for representing the parent or children and still make sense, and easily understandable when referring to it..."the template will display in the route-container you specified..."

On Thu, Apr 16, 2015 at 11:55 AM Kevin Preller notifications@github.com wrote:

I think ng-viewport was a very great name, too, because "viewport" expresses what the component actually does. I think "route-content" doesn't really reflect this. I guess we can't go with router-viewport instead?

I like the idea @AnthonyPAlicea https://github.com/AnthonyPAlicea mentioned: "ng-content-placeholder".

— Reply to this email directly or view it on GitHub https://github.com/angular/router/issues/264#issuecomment-93814669.

gautelo commented 9 years ago

I'm not sure <route-viewport/> will be that confusing. Developers are used to namespaces and words changing meaning based on its namespace-context. So I'm not sure it has to be off the table.

I agree that the directive name should be prefixed by/namespaced to route or router. I'm kind of leaning toward router as the better prefix. As I see it the body is the outlet of the complete route whereas the router works with partial routes and instantiates a component based off of that. So I guess it might make more sense for the router to place things into a <router-outlet/> than into a <route-outlet/>.

So, what should be the postfix? I like both <router-outlet/> and <router-content/>. Though I think the former sounds better and kind of makes more sense I'm leaning toward the latter because of <content/>. We transclude a components content into its internal <content/> tag. Similarly it would make sense for the router to transclude its content (the component) into a <router-content/> tag.

robwormald commented 9 years ago

in iOS, we call these "Container Views" - so how about or ?

See https://developer.apple.com/library/ios/featuredarticles/ViewControllerPGforiPhoneOS/CreatingCustomContainerViewControllers/CreatingCustomContainerViewControllers.html

kpko commented 9 years ago

@gautelo Yes, I thought a prefixed version of viewport would be enough, too. @btford What's your opinion on this? Personally I think <router-viewport/> would be great. What's the naming convention for components in Angular 2.0 apps?

darcnite3000 commented 9 years ago

From what i've seen in NG2 talks it seems like they are removing the namespacing convention because a component can be included in and renamed in a class on the fly. The current stuff seems to be more 'what i am doing' than 'what am i'.

btford commented 9 years ago

@gautelo – It's hard to tell. In Angular 1, we got so much feedback about confusing names that we want to be really picky with names in Angular 2. Just as a general guiding principle, I think it's best to keep the name of this directive distinct from the concept of "views" in Angular 2.

@robwormald – thanks for the reference!

@darcnite3000 – great insight!

I'm going to add route-container to the original post and start to tally votes just to get a general idea of where people stand.

darcnite3000 commented 9 years ago

I'd have to :+1: route-container over route-content because 'content' feels more definitive, as in this is the content, and the only content. 'container' (or words like outlet) give more of a you can have multiple of these feeling.

As an aside to using the prefix route, it's probably a good thing to do because the 'ComponentRouter' (aka new angular router) is still going to be used in ng1. As an aside in ng2 you could always rename it yourself to just be 'container' (which you wouldn't want to do with 'content' due to there already being a 'content' in html tied to the shadow dom and templates [which in it self would be confusing])

nverba commented 9 years ago

aperture?

<aperture name="main"></aperture>

In it's most literal sense, just means 'an opening'.

darcnite3000 commented 9 years ago

would be a good choice if we named the router 'BlackMesa'

gautelo commented 9 years ago

As a person with English as my second language, I had to look 'aperture' up. The last word from Angular nomenclature I had to look up was 'transclusion'. Just saying...

darcnite3000 commented 9 years ago

as a person with english as my first language i had to look up transclusion

nverba commented 9 years ago

@gautelo, I was going for something distinct, but you make a fair point...

What about:

<route-display name="main"></route-display>

<div route-display="main"><div>

or just

<display name="main"></display>

<div display="main"><div>
gautelo commented 9 years ago

@nverba Well done on coming up with new ideas. I like route-display! It makes the same kind of sense that route-outlet does but fits more easily into normal language: "The route-display is where the router places its component." Nice!

I prefer route-display over display. Being specific is good.

wulfsberg commented 9 years ago

Not fond of "outlet". It sounds somewhat contrived and not all that router/display-specific. (When I see "outlet", my mind goes to data pipes and sinks more generically, not to displaying HTML in a template slot). I like router-viewport and I think it's explicit enough to not collide with other meanings. route-display is also nicely straightforward.

kamrenz commented 9 years ago

It seems the documentation and examples have been updated to reflect the move to <ng-outlet> as the new name. However, when I grab the latest version of the router I still need to use <ng-viewport>. Any ideas why?

btford commented 9 years ago

I only re-generate the dist folder on a release. I'll cut a new release soon. Until then, building the router locally will solve your issue.

On Wed, Apr 22, 2015, 19:01 Kamren Z notifications@github.com wrote:

It seems the documentation and examples have been updated to reflect the move to as the new name. However, when I grab the latest version of the router I still need to use . Any ideas why?

— Reply to this email directly or view it on GitHub https://github.com/angular/router/issues/264#issuecomment-95390368.

kamrenz commented 9 years ago

Awesome and thanks @btford !

0x-r4bbit commented 9 years ago

I really don't want to be mean, but this commit here landed just recently in the angular code base (https://github.com/angular/angular/commit/3aac2fefd7f93c74abfa5ee58aa0ea8d4840b519) which actually lets us use viewport as a term again (which I also like more) :)

Just leaving that here.

kpko commented 9 years ago

Ha! :-)

That's great. I still think Viewport was the better matching term. Does anything speak against using it again at this point?

0x-r4bbit commented 9 years ago

Since Brian just gave a talk on the router at the Boston meetup where he announced the latest renames, I don't think we'll switch again.

wulfsberg commented 9 years ago

I think flip-flopping a little now is better than settling on a poorer choice for years, so my vote still goes to router-viewport.

btford commented 9 years ago

@PascalPrecht – Haha, no worries. I'm aware of that commit.

There was another time when "Viewport" was removed (or being considered for removal) from Angular 2, and then it was later re-introduced.

I'm open to reopening this discussion in light of "viewport" being open, but we may be in the same spot again in the future.

Names are hard.

frodefi commented 9 years ago

How about ng-pagepart?

dsebastien commented 9 years ago

Naming stuff is by far one of the most difficult things in IT (also happens to be true for babies eh ;-))

'route-display' makes a lot of sense to me. Something like 'routes-anchor' could also be nice to express the fact that component views end up in there.