Advertisement
Guest User

Untitled

a guest
Aug 16th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. import { Component, ViewContainerRef, ViewChild } from '@angular/core';
  2. import { Field } from 'ng-formly';
  3. @Component({
  4. selector: 'formly-checkbox-inline',
  5. template: `
  6.  
  7. <h5 class="form-control-label">{{to.label}}</h5>
  8. <div *ngFor="let opt of to.options" class="form-check form-check-inline">
  9. <label class="form-check-label">
  10. <input [formControl]="formControl" class="form-check-input mr-2" type="checkbox" name="{{key}}" id="{{opt.key}}" value="{{opt.value}}"> {{opt.value}}
  11. </label>
  12. </div>
  13. `,
  14. styles: [ `
  15. .form-check-inline {
  16. margin-top: .45rem;
  17. margin-bottom: 0rem;
  18. padding-left: .9rem;
  19. padding-right: .9rem;
  20. padding-top: .3rem;
  21. padding-bottom: .4rem;
  22. background-color: #e5e5e5;
  23. border-radius: 5px;
  24. }
  25. `]
  26. })
  27. export class FormlyInlineCheckbox extends Field {
  28. @ViewChild('fieldComponent', {read: ViewContainerRef}) fieldComponent: ViewContainerRef;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement