@angular/core#Component TypeScript Examples

The following examples show how to use @angular/core#Component. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: property-card.component.ts    From one-platform with MIT License 6 votes vote down vote up
@Component({
  selector: 'app-property-card',
  templateUrl: './property-card.component.html',
  styleUrls: ['./property-card.component.scss']
})
export class PropertyCardComponent implements OnInit {

  constructor() { }

  ngOnInit(): void {
  }

}
Example #2
Source File: how-it-works.component.ts    From 1hop with MIT License 6 votes vote down vote up
@Component({
  selector: 'app-how-it-works',
  templateUrl: './how-it-works.component.html',
  styleUrls: ['./how-it-works.component.scss']
})
export class HowItWorksComponent implements OnInit {

  constructor() { }

  ngOnInit() {
  }

}
Example #3
Source File: leverage.component.ts    From 1x.ag with MIT License 6 votes vote down vote up
@Component({
    selector: 'app-leverage',
    templateUrl: './leverage.component.html',
    styleUrls: ['./leverage.component.scss']
})
export class LeverageComponent {
    constructor() {

    }
}
Example #4
Source File: app.component.ts    From Uber-ServeMe-System with MIT License 6 votes vote down vote up
@Component({
  selector: 'app-root',
  templateUrl: 'app.component.html',
  styleUrls: ['app.component.scss']
})
export class AppComponent {

  showSplash = true;

  constructor(
    private platform: Platform,
    private splashScreen: SplashScreen,
    private statusBar: StatusBar,
  ) {
    this.initializeApp();
  }
  
  initializeApp() {
    this.platform.ready().then(() => {
      Environment.setEnv({      
        'API_KEY_FOR_BROWSER_RELEASE': 'AIzaSyBfdfHVfFgZbqw40ZBzZZa7kMTrEOvxarg',
        'API_KEY_FOR_BROWSER_DEBUG': 'AIzaSyBfdfHVfFgZbqw40ZBzZZa7kMTrEOvxarg'
      });
      this.statusBar.overlaysWebView(false);
      this.statusBar.styleLightContent();
      setTimeout(() => {
        this.splashScreen.hide();
      }, 300);
      timer(3000).subscribe(() => this.showSplash = false)
    });
  }
}
Example #5
Source File: app.component.ts    From ngx-photo-editor with MIT License 6 votes vote down vote up
@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {

  base64: any;
  imageChangedEvent: any;
  imageUrl: any;

  fileChangeEvent(event: any) {
    this.imageChangedEvent = event;
  }


  imageCropped(event: CroppedEvent) {
    console.log(event);
    this.base64 = event.base64;
  }

  gotoGithub() {
    window.open('https://github.com/AhamedBilal/ngx-photo-editor');
  }

  // gotoNPM() {
  //   window.open('https://www.npmjs.com/package/ngx-photo-editor');
  // }
}
Example #6
Source File: nav-menu.component.ts    From Angular-Computer-Vision-Azure-Cognitive-Services with MIT License 6 votes vote down vote up
@Component({
  selector: 'app-nav-menu',
  templateUrl: './nav-menu.component.html',
  styleUrls: ['./nav-menu.component.scss']
})
export class NavMenuComponent {
  isExpanded = false;

  collapse() {
    this.isExpanded = false;
  }

  toggle() {
    this.isExpanded = !this.isExpanded;
  }
}
Example #7
Source File: about.component.ts    From transformers-for-lawyers with Apache License 2.0 6 votes vote down vote up
@Component({
  templateUrl: './about.component.html',
  styleUrls: ['./about.component.css']
})
export class AboutComponent implements OnInit {

  constructor() { }

  ngOnInit(): void {
  }

}
Example #8
Source File: paginator.directive.spec.ts    From angular-custom-material-paginator with MIT License 6 votes vote down vote up
@Component({
  template: `
    <mat-paginator appPagination
                   [pageIndex]="pageIndex"
                   [pageSize]="pageSize"
                   [pageSizeOptions]="pageSizeOptions"
                   [hidePageSize]="hidePageSize"
                   [showFirstLastButtons]="showFirstLastButtons"
                   [length]="length"
                   [color]="color"
                   [disabled]="disabled"
                   (page)="pageEvent($event)">
    </mat-paginator>
  `,
})

// tslint:disable-next-line: component-class-suffix
class MatPaginatorApp {
  pageIndex = 0;
  pageSize = 10;
  pageSizeOptions = [5, 10, 25, 100];
  hidePageSize = false;
  showFirstLastButtons = false;
  length = 100;
  disabled: boolean;
  pageEvent = jasmine.createSpy('Page Event');
  color: ThemePalette;
  @ViewChild(MatPaginator) paginator: MatPaginator;
}
Example #9
Source File: app.component.ts    From DocumentationWebPage with MIT License 6 votes vote down vote up
@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  
  title = 'BlueXolo';
  color = '#546e7a';
  spa: Boolean = false;

  constructor(private router: Router){}

  goHome(): void {
    this.spa = false;
    window.location.replace('#home');
  }

  goInformation() {
    this.spa = false;
    window.location.replace('#information');
  }

  goFooter() {
      this.spa = false;
      window.location.replace('#footer');
  }

  goDocumentation() {
    this.spa = true;
    this.router.navigate(['/documentation']);
  }
}
Example #10
Source File: progress-bar.component.ts    From homebridge-nest-cam with GNU General Public License v3.0 6 votes vote down vote up
@Component({
  selector: 'progress-bar',
  templateUrl: './progress-bar.component.html',
  styleUrls: ['./progress-bar.component.css'],
})
export class ProgressBarComponent {
  @Input() progress?: number;
  @Input() total?: number;
  @Input() color = 'blue';

  constructor() {
    //if we don't have progress, set it to 0.
    if (!this.progress) {
    }
    //if we don't have a total aka no requirement, it's 100%.
    if (this.total === 0) {
      this.total = this.progress;
    } else if (!this.total) {
      this.total = 100;
    }
    //if the progress is greater than the total, it's also 100%.
    if (this.progress && this.total) {
      if (this.progress > this.total) {
        this.progress = 100;
        this.total = 100;
      }
      this.progress = (this.progress / this.total) * 100;
    }
  }
}
Example #11
Source File: example1.component.ts    From bdc-walkthrough with MIT License 6 votes vote down vote up
@Component({
  selector: 'bdc-example1',
  templateUrl: './example1.component.html',
  styleUrls: ['./example1.component.scss']
})
export class Example1Component implements OnInit {

  constructor(private bdcWalkService: BdcWalkService) {
  }

  ngOnInit() {
  }

  reset() {
    this.bdcWalkService.reset('example1');
  }
}
Example #12
Source File: app.component.ts    From Smersh with MIT License 6 votes vote down vote up
@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss'],
})
export class AppComponent implements OnInit {
  title = 'Smersh';
  @HostBinding('class') className = Theme.LIGHT_THEME;
  protected logged: boolean;

  constructor(
    private http: HttpClient,
    private router: Router,
    private dialog: MatDialog,
    private themeService: ThemeService
  ) {}

  ngOnInit(): void {
    this.themeService.onChangeTheme.subscribe(
      (theme) => (this.className = theme)
    );

    // check if valid jwt
    if (Date.now() < new DecodedToken().getDecoded().exp * 1000) {
      this.logged = true;
    } else {
      new Token().reset();
      this.router.navigateByUrl('/login');
    }
  }
}
Example #13
Source File: about.component.ts    From TypeFast with MIT License 6 votes vote down vote up
@Component({
  selector: 'app-about',
  templateUrl: './about.component.html',
  styleUrls: ['./about.component.scss'],
})
export class AboutComponent implements OnInit {
  @Output() onAboutClosed = new EventEmitter<void>();

  ngOnInit(): void {
    // Empty
  }

  closeAbout(): void {
    this.onAboutClosed.emit();
  }
}
Example #14
Source File: image-search.component.ts    From frontend-framework-showdown-2020 with MIT License 6 votes vote down vote up
@Component({
  selector: 'app-image-search',
  templateUrl: './image-search.component.html',
  styleUrls: ['./image-search.component.css']
})
export class ImageSearchComponent implements OnInit {
  searchTerm = '';
  loading = false;
  images: string[] = [];

  constructor(private imageAPIService: ImageApiService) { }

  ngOnInit(): void {}

  formSubmitted() {
    this.images = [];
    this.loading = true;
    this.imageAPIService.getImages(this.searchTerm)
      .subscribe((images: string[]) => {
        this.images = images;
        this.loading = false;   
      });
  }

}
Example #15
Source File: mobile-menu.component.ts    From xBull-Wallet with GNU Affero General Public License v3.0 6 votes vote down vote up
@Component({
  selector: 'app-mobile-menu',
  templateUrl: './mobile-menu.component.html',
  styleUrls: ['./mobile-menu.component.scss']
})
export class MobileMenuComponent implements OnInit {
  advanceMode$ = this.settingsQuery.advanceMode$;

  constructor(
    private readonly nzDrawerRef: NzDrawerRef,
    private readonly settingsQuery: SettingsQuery,
  ) { }

  ngOnInit(): void {
  }

  closeDrawer(): void {
    this.nzDrawerRef.close();
  }
}
Example #16
Source File: app.component.ts    From one-platform with MIT License 5 votes vote down vote up
@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss']
})
export class AppComponent {
  title = 'One Platform | Lighthouse';
}
Example #17
Source File: app.component.ts    From 1hop with MIT License 5 votes vote down vote up
@Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.scss']
})
export class AppComponent implements OnInit {

    constructor(
        protected web3Service: Web3Service,
        protected configurationService: ConfigurationService,
        protected themeService: ThemeService,
        protected swUpdate: SwUpdate,
        protected appRef: ApplicationRef,
        @Inject(DOCUMENT) private document: Document
    ) {

    }

    ngOnInit() {

        if (
            (
                navigator.userAgent.toLowerCase().indexOf('android') === -1 ||
                (document.fullscreenElement || document.fullscreenElement === null)
            ) &&
            'serviceWorker' in navigator && environment.production
        ) {

            this.swUpdate.available.subscribe(event => {

                console.log('current version is', event.current);
                console.log('available version is', event.available);

                this.swUpdate.activateUpdate().then(() => document.location.reload());
            });

            this.swUpdate.activated.subscribe(event => {
                console.log('old version was', event.previous);
                console.log('new version is', event.current);
            });
        }

        this.checkForUpdates();
    }

    @HostListener('window:focus', ['$event'])
    onFocus(event: FocusEvent): void {

        this.checkForUpdates();
    }

    async checkForUpdates() {

        if (
            (
                navigator.userAgent.toLowerCase().indexOf('android') === -1 ||
                (document.fullscreenElement || document.fullscreenElement === null)
            ) &&
            'serviceWorker' in navigator && environment.production
        ) {

            this.swUpdate.checkForUpdate();
        }
    }
}
Example #18
Source File: app.component.ts    From 1x.ag with MIT License 5 votes vote down vote up
@Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.scss']
})
export class AppComponent implements OnInit  {

    constructor(
        protected web3Service: Web3Service,
        protected configurationService: ConfigurationService,
        protected themeService: ThemeService,
        protected swUpdate: SwUpdate,
        protected appRef: ApplicationRef,
        private deviceDetectorService: DeviceDetectorService,
        @Inject(DOCUMENT) private document: Document
    ) {

    }

    ngOnInit() {

        if (this.deviceDetectorService.isDesktop()) {
            this.document.body.classList.add('twitter-scroll');
        }

        if (
            (
                navigator.userAgent.toLowerCase().indexOf('android') === -1 ||
                (document.fullscreenElement || document.fullscreenElement === null)
            ) &&
            'serviceWorker' in navigator && environment.production
        ) {

            this.swUpdate.available.subscribe(event => {

                console.log('current version is', event.current);
                console.log('available version is', event.available);

                this.swUpdate.activateUpdate().then(() => document.location.reload());
            });

            this.swUpdate.activated.subscribe(event => {
                console.log('old version was', event.previous);
                console.log('new version is', event.current);
            });
        }

        this.checkForUpdates();
    }

    @HostListener('window:focus', ['$event'])
    onFocus(event: FocusEvent): void {

        this.checkForUpdates();
    }

    async checkForUpdates() {

        if (
            (
                navigator.userAgent.toLowerCase().indexOf('android') === -1 ||
                (document.fullscreenElement || document.fullscreenElement === null)
            ) &&
            'serviceWorker' in navigator && environment.production
        ) {

            this.swUpdate.checkForUpdate();
        }
    }
}