Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { Directive, OnInit, HostBinding, Input } from '@angular/core';
- @Directive({
- selector: '[appServerSuccess]'
- })
- export class ServerSuccessDirective implements OnInit {
- @Input() appServerSuccess: string;
- @HostBinding()
- get innerText() {
- return this.appServerSuccess;
- }
- @HostBinding('class.success')
- get success () {
- return this.appServerSuccess.toLocaleLowerCase().includes('success');
- }
- constructor() {}
- ngOnInit() {}
- }
- import { NgModule } from "@angular/core";
- import { ServerSuccessDirective } from './directives/server-success.directive';
- @NgModule({
- imports: [ ],
- declarations: [ ServerSuccessDirective ],
- exports: [ ServerSuccessDirective ]
- })
- export class SharedModule {}
- <div [appServerSuccess]="msg"></div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement