How to use angular-playground - 10 common examples

To help you get started, we’ve selected a few angular-playground examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SoCreate / angular-playground / examples / cli-example / src / main.playground.ts View on Github external
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { PlaygroundModule } from 'angular-playground';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { ServiceWorkerModule } from '@angular/service-worker';
import { environment } from './environments/environment';
import { enableProdMode } from '@angular/core';

enableProdMode();

PlaygroundModule
  .configure({
    selector: 'app-root',
    overlay: true,
    modules: [
      BrowserAnimationsModule,
      environment.production ? ServiceWorkerModule.register('/ngsw-worker.js') : []
    ]
  });

platformBrowserDynamic().bootstrapModule(PlaygroundModule)
  .catch(err => console.error(err));
github SoCreate / angular-playground / examples / cli-example / src / app / feature1 / person-details.component.sandbox.ts View on Github external
import { sandboxOf } from 'angular-playground';
import { PersonDetailsComponent } from './person-details.component';
import { PersonBioComponent } from './person-bio.component';
import { NO_ERRORS_SCHEMA } from '@angular/core';

export default sandboxOf(PersonDetailsComponent, {
  label:'feature1',
  declarations: [PersonBioComponent],
  entryComponents: [PersonBioComponent],
  schemas: [NO_ERRORS_SCHEMA]
})
  .add('person with name and twitter', {
    template: '',
    context: {
      person: {
        fullName: 'Tom Hardy',
        twitterHandle: 'mjones'
      }
    }
  })
  .add('person with name', {
    template: '',
github SoCreate / angular-playground / examples / example-app-webpack / src / app / shared / notice.component.sandbox.ts View on Github external
import { sandboxOf } from 'angular-playground';
import { CounterService } from './counter.service';
import { NoticeComponent } from './notice.component';

class MockCounterService {
  increment() {
    return 100;
  }
}

export default sandboxOf(NoticeComponent, {providers: [CounterService], })
  .add('short text', {
    template: 'Notification'
  })
  .add('long text', {
    template: 'This is a really super long notice!'
  })
  .add('with emoji', {
    template: '👻'
  })
  .add('with custom provider', {
    template: 'Notice one hundred',
    providers: [{provide: CounterService, useClass: MockCounterService}]
  })
  .add('with inner html', {
    template: `<h1>A heading in a notice</h1>`
  })
github SoCreate / angular-playground / examples / cli-example / src / app / shared / animated.component.sandbox.ts View on Github external
import { sandboxOf } from 'angular-playground';
import { AnimatedComponent } from './animated.component';
export default sandboxOf(AnimatedComponent)
  .add('default', {
    template: ``
  });
github DanWahlin / Angular-JumpStart / src / app / about / about.component.sandbox.ts View on Github external
import { sandboxOf } from 'angular-playground';
import { AboutComponent } from './about.component';

export default sandboxOf(AboutComponent)
  .add('About Component', {
    template: ``
  });
github DanWahlin / Angular-JumpStart / src / app / customer / customer-details / customer-details.component.sandbox.ts View on Github external
import { MockDataService, MockActivatedRoute, getActivatedRouteWithParent } from '../../shared/mocks';
import { ActivatedRoute } from '@angular/router';

const sandboxConfig = {
  imports: [ SharedModule, CoreModule ],
  providers: [
      { provide: DataService, useClass: MockDataService },
      { provide: ActivatedRoute, useFactory: () =&gt; {
        const route = getActivatedRouteWithParent([{ id: '1' }]);
        return route;
      }}
  ],
  label: 'Customer Details Component'
};

export default sandboxOf(CustomerDetailsComponent, sandboxConfig)
  .add('With a Customer', {
    template: ``
  })
  .add('Without a Customer', {
    template: ``,
    providers: [
      { provide: ActivatedRoute, useFactory: () =&gt; {
        const route = getActivatedRouteWithParent([{ id: null }]);
        return route;
      }}
    ]
  });
github SoCreate / angular-playground / examples / cli-example / src / app / feature1 / person-bio.component.sandbox.ts View on Github external
import {sandboxOf} from 'angular-playground';
import {PersonBioComponent} from './person-bio.component';
export default sandboxOf(PersonBioComponent, {label:'feature1'})
  .add('default', {template:``});
github SoCreate / angular-playground / examples / cli-example / src / app / feature1 / person-bio.component.other.sandbox.ts View on Github external
import {sandboxOf} from 'angular-playground';
import {PersonBioComponent} from './person-bio.component';
export default sandboxOf(PersonBioComponent, {label:'feature1'})
  .add('a special case', {template:`<h1>Special Bio</h1>`});
github SoCreate / angular-playground / examples / cli-example / src / app / feature2 / info-block.component.sandbox.ts View on Github external
import { sandboxOf } from 'angular-playground';
import { InfoBlockComponent } from './info-block.component';

export default sandboxOf(InfoBlockComponent)
  .add('A general example', {
    template: `
      
        This is a general info block example component
        in Playground
      `
    })
  .add('A warning example', {
    template: `
      
        This is a "warning" info block example 
        component in Playground
      `
    })
  .add('An error example', {
    template: `
github DanWahlin / Angular-JumpStart / src / app / customers / customers-card / customers-card.component.sandbox.ts View on Github external
import { sandboxOf } from 'angular-playground';
import { SharedModule } from '../../shared/shared.module';
import { CustomersCardComponent } from './customers-card.component';
import { RouterTestingModule } from '@angular/router/testing';
import { CoreModule } from '../../core/core.module';
import { customers } from '../../shared/mocks';

const sandboxConfig = {
  imports: [ SharedModule, CoreModule, RouterTestingModule ],
  label: 'Customers Card Component'
};

export default sandboxOf(CustomersCardComponent, sandboxConfig)
  .add('With Many Customers', {
    template: ``,
    context: {
      customers: customers
    }
  })
  .add('With 10 Customers', {
    template: ``,
    context: {
      customers: customers.slice(0, 10)
    }
  })
  .add('With 4 Customers', {
    template: ``,
    context: {
      customers: customers.slice(0, 4)

angular-playground

A drop in app module for working on Angular components in isolation (aka Scenario Driven Development).

MIT
Latest version published 2 years ago

Package Health Score

51 / 100
Full package analysis