-
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add service add demo add type remove unused tests
- Loading branch information
1 parent
6fc3344
commit d6857ea
Showing
7 changed files
with
97 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { | ||
ApplicationRef, | ||
ComponentFactoryResolver, | ||
ElementRef, | ||
Inject, | ||
Injectable, | ||
Injector, | ||
NgZone, | ||
TemplateRef | ||
} from '@angular/core'; | ||
import { HELIPOPPER_CONFIG, HelipopperConfig, HelipopperOptions } from './helipopper.types'; | ||
import { HelipopperDirective } from './helipopper.directive'; | ||
|
||
@Injectable({ | ||
providedIn: 'root' | ||
}) | ||
export class HelipopperService { | ||
constructor( | ||
private appRef: ApplicationRef, | ||
private zone: NgZone, | ||
private resolver: ComponentFactoryResolver, | ||
private hostInjector: Injector, | ||
@Inject(HELIPOPPER_CONFIG) private config: HelipopperConfig | ||
) {} | ||
|
||
open(host: ElementRef, helipopper: string | TemplateRef<any>, options?: HelipopperOptions) { | ||
let directive: HelipopperDirective = new HelipopperDirective( | ||
host, | ||
this.appRef, | ||
this.zone, | ||
this.resolver, | ||
this.hostInjector, | ||
this.config | ||
); | ||
|
||
//todo : if helipopperAppendTo === undefined then document.body; | ||
//todo : if helipopperOptions === undeifned then {} | ||
// todo : if helipopperTextOverflow === undefined then showOnlyOnTextOverflow = false | ||
directive.helipopper = helipopper; | ||
|
||
directive.whenStable.subscribe(() => { | ||
directive.show(); | ||
}); | ||
|
||
return directive; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from './lib/helipopper.module'; | ||
export * from './lib/helipopper.directive'; | ||
export * from './lib/helipopper.service'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters