refactor(overlays): inject overlay providers

BREAKING CHANGES:

- Overlay components, such as Alert or Modals, should now be created
using its injected provider.
- Overlays now have the `present()` method on the overlay’s instance,
rather than using `nav.present(overlayInstance)`.
- All overlays now present on top of all app content, to include menus.
- Below is an example of the change to `Alert`, but the pattern is the
same for all overlays: ActionSheet, Loading, Modal, Picker, Popover,
Toast

WAS:

```
import { NavController, Alert } from ‘ionic-angular’;

constructor(private nav: NavController) {
}

doAlert() {
  let alert = Alert.create({
    title: 'Alert',
  });
  this.nav.present(alert);
}
```

NOW:

```
import { AlertController } from ‘ionic-angular’;

constructor(private alertCtrl: AlertController) {
}

doAlert() {
  let alert = this.alertCtrl.create({
    title: 'Alert'
  });
  alert.present();
}
```
This commit is contained in:
Adam Bradley
2016-06-28 15:18:09 -05:00
parent 2fe42ed63e
commit 215c6d846c
39 changed files with 3578 additions and 3303 deletions

View File

@ -5,7 +5,6 @@ import { Config } from '../../config/config';
import { Keyboard } from '../../util/keyboard';
import { isTrueProperty } from '../../util/util';
import { NavController } from './nav-controller';
import { NavPortal } from './nav-portal';
import { ViewController } from './view-controller';
/**
@ -108,8 +107,10 @@ import { ViewController } from './view-controller';
*/
@Component({
selector: 'ion-nav',
template: '<div #viewport nav-viewport></div><div class="nav-decor"></div><div nav-portal></div>',
directives: [NavPortal],
template: `
<div #viewport nav-viewport></div>
<div class="nav-decor"></div>
`,
encapsulation: ViewEncapsulation.None,
})
export class Nav extends NavController implements AfterViewInit {
@ -194,8 +195,4 @@ export class Nav extends NavController implements AfterViewInit {
this._sbEnabled = isTrueProperty(val);
}
@ViewChild(NavPortal)
private set _np(val: NavPortal) {
this.setPortal(val);
}
}