"You did not provide a ViewContainerRef. " exception due calling selectDate
See original GitHub issueA "You did not provide a ViewContainerRef. " exception is thrown when calling selectDate.
"@angular-mdl/core": "^4.0.3",
"@angular-mdl/datepicker": "0.0.2",
"@angular-mdl/popover": "^0.6.3",
"@angular-mdl/select": "^0.10.4",
<button mdl-button (click)="pickADate($event)" mdl-button-type="icon" mdl-ripple>
<mdl-icon>event</mdl-icon>
</button>
<span>{{ selectedDate?.format('LL') }}</span>
import { MdlDatePickerService } from '@angular-mdl/datepicker';
import * as moment from 'moment';
constructor(
private datePicker: MdlDatePickerService) { }
public pickADate($event: MouseEvent) {
this.datePicker.selectDate(this.selectedDate, { openFrom: $event }).subscribe((selectedDate: Date) => {
this.selectedDate = selectedDate ? moment(selectedDate) : null;
});
}
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Anguler2 - Unhandled Promise rejection: No provider for ...
What you can do is to inject ViewContainerRef and a service to a component and then in the constructor pass the ViewContainerRef to...
Read more >ViewContainerRef - Angular
Anchor element that specifies the location of this container in the containing view. Each view container can have only one anchor element, and...
Read more >Understanding ViewContainerRef in Angular 2 - Netanel Basal
When you need to add new DOM element (i.e., component, template) you need a place to insert the element. Angular is not magic;...
Read more >UNPKG - @angular/material
If the tabs are not ready yet, we assume that the user is\n * providing a valid ... TemplateRef, ViewContainerRef} from '@angular/core';\nimport {CdkPortal} ......
Read more >[angular] All about the ViewContainerRef - Medium
Note, that ng-template also can provide viewContainerRef and that's how we can create structural directive. @Component({ selector: 'my-app',
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Actually I found out that app should import
MdlDialogModule
at the root level for date picker to work (importing it in a sub module won’t work). I could not find that information in the given documentation. Even though that is straight forward to import it, I think that should be included in the documentation to be on the safe side.MdlDialogModule
must be imported asMdlDialogModule.forRoot()
inapp.module.ts