Browse Source

feat(theme-basic): implement dom insertion service to append style

pull/3475/head
mehmet-erim 7 years ago
parent
commit
0d44a7d5ce
  1. 9
      npm/ng-packs/packages/theme-basic/src/lib/services/initial.service.ts

9
npm/ng-packs/packages/theme-basic/src/lib/services/initial.service.ts

@ -1,4 +1,4 @@
import { LazyLoadService, AddReplaceableComponent } from '@abp/ng.core'; import { DomInsertionService, AddReplaceableComponent, CONTENT_STRATEGY } from '@abp/ng.core';
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Store } from '@ngxs/store'; import { Store } from '@ngxs/store';
import styles from '../constants/styles'; import styles from '../constants/styles';
@ -8,8 +8,9 @@ import { EmptyLayoutComponent } from '../components/empty-layout/empty-layout.co
@Injectable({ providedIn: 'root' }) @Injectable({ providedIn: 'root' })
export class InitialService { export class InitialService {
constructor(private lazyLoadService: LazyLoadService, private store: Store) { constructor(private domInsertion: DomInsertionService, private store: Store) {
this.appendStyle().subscribe(); this.appendStyle();
this.store.dispatch([ this.store.dispatch([
new AddReplaceableComponent({ new AddReplaceableComponent({
key: 'Theme.ApplicationLayoutComponent', key: 'Theme.ApplicationLayoutComponent',
@ -27,6 +28,6 @@ export class InitialService {
} }
appendStyle() { appendStyle() {
return this.lazyLoadService.load(null, 'style', styles, 'head', 'beforeend'); this.domInsertion.insertElement(CONTENT_STRATEGY.AppendStyleToHead(styles));
} }
} }

Loading…
Cancel
Save