mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
docs(snackbar): remove unnecessary viewContainerRef (#1803)
This commit is contained in:
committed by
Jeremy Elbourn
parent
5a04ab6701
commit
adfc4d1783
@@ -1,4 +1,4 @@
|
||||
import {Component, ViewContainerRef} from '@angular/core';
|
||||
import {Component} from '@angular/core';
|
||||
import {MdSnackBar} from '@angular/material';
|
||||
|
||||
@Component({
|
||||
@@ -12,8 +12,7 @@ export class SnackBarDemo {
|
||||
action: boolean = false;
|
||||
|
||||
constructor(
|
||||
public snackBar: MdSnackBar,
|
||||
public viewContainerRef: ViewContainerRef) { }
|
||||
public snackBar: MdSnackBar) { }
|
||||
|
||||
open() {
|
||||
this.snackBar.open(this.message, this.action && this.actionButtonLabel);
|
||||
|
||||
@@ -26,12 +26,10 @@ The service can be injected in a component.
|
||||
})
|
||||
export class MyComponent {
|
||||
|
||||
constructor(snackBar: MdSnackBar
|
||||
viewContainerRef: ViewContainerRef) {}
|
||||
constructor(snackBar: MdSnackBar) {}
|
||||
|
||||
failedAttempt() {
|
||||
config = new MdSnackBarConfig(this.viewContainerRef);
|
||||
this.snackBar.open('It didn\'t quite work!', 'Try Again', config);
|
||||
this.snackBar.open('It didn\'t quite work!', 'Try Again');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user