Skip to content

Instantly share code, notes, and snippets.

@sebastienlevert
Created December 4, 2017 17:24
Show Gist options
  • Save sebastienlevert/e9859b9f00f2d7117587e19ee6a13e81 to your computer and use it in GitHub Desktop.
Save sebastienlevert/e9859b9f00f2d7117587e19ee6a13e81 to your computer and use it in GitHub Desktop.
import { Component, NgModule, Input, ViewEncapsulation } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { CommonModule } from '@angular/common';
import { WebPartContext } from '@microsoft/sp-webpart-base';
import { ListsService } from '../../../services/lists.service';
import { List } from '../../../models/list';
import { Environment, EnvironmentType } from '@microsoft/sp-core-library';
import { MockListsService } from '../../../services/mock/lists.service';
@Component({
selector: 'mock-data',
templateUrl: './mock-data.html',
styleUrls: [ './mock-data.scss' ],
encapsulation: ViewEncapsulation.None
})
export class MockData {
@Input() context: WebPartContext;
public lists: Promise<List[]>;
constructor(private listsService: ListsService) { }
ngOnInit(){
if(!this.context){
console.error('Please provide the context!');
return;
}
this.lists = this.listsService.getLists(this.context);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment