Skip to content

Commit

Permalink
Merge pull request emberjs#1041 from joliss/doc
Browse files Browse the repository at this point in the history
Update connectOutlet documentation to reflect recent changes
  • Loading branch information
tomdale committed Jun 19, 2012
2 parents 0df46e3 + b35b0ae commit 747816e
Showing 1 changed file with 18 additions and 21 deletions.
39 changes: 18 additions & 21 deletions packages/ember-views/lib/system/controller.js
Expand Up @@ -26,19 +26,7 @@ Ember.ControllerMixin.reopen({
following code will assign a new `App.PostsView` to
that outlet:
applicationController.connectOutlet(App.PostsView);
You can specify a particular outlet to use as the first
parameter to `connectOutlet`. For example, if your
main template looks like:
<h1>My Blog</h1>
{{outlet master}}
{{outlet detail}}
You can assign an `App.PostsView` to the master outlet:
applicationController.connectOutlet('master', App.PostsView);
applicationController.connectOutlet('posts');
In general, you will also want to assign a controller
to the newly created view. By convention, a controller
Expand All @@ -56,18 +44,27 @@ Ember.ControllerMixin.reopen({
You can supply a `content` for the controller by supplying
a final argument after the view class:
applicationController.connectOutlet(App.PostsView, App.Post.find());
applicationController.connectOutlet('posts', App.Post.find());
You can specify a particular outlet to use. For example, if your main
template looks like:
<h1>My Blog</h1>
{{outlet master}}
{{outlet detail}}
You can assign an `App.PostsView` to the master outlet:
The only required argument is `viewClass`. You can optionally
specify an `outletName` before `viewClass` and/or a `context`
after `viewClass` in any combination.
applicationController.connectOutlet({
name: 'posts',
outletName: 'master',
context: App.Post.find()
});
@param {String} outletName the name of the outlet to assign
the newly created view to (optional)
@param {Class} viewClass a view class to instantiate
@param {Class} name a view class to instantiate
@param {Object} context a context object to assign to the
controller's `content` property, if a controller can be
found.
found (optional)
*/
connectOutlet: function(name, context) {
// Normalize arguments. Supported arguments:
Expand Down

0 comments on commit 747816e

Please sign in to comment.