Skip to main content

Posts

Angular Basic Syntax

Cheat Sheet Bootstrapping import {  platformBrowserDynamic  } from '@angular/platform-browser-dynamic'; platformBrowserDynamic ().bootstrapModule (AppModule); Bootstraps the app, using the root component from the specified  NgModule . NgModules import {  NgModule  } from '@angular/core'; @ NgModule ({ declarations: ..., imports: ..., exports: ..., providers: ..., bootstrap: ...}) class MyModule {} Defines a module that contains components, directives, pipes, and providers. declarations:  [MyRedComponent, MyBlueComponent, MyDatePipe] List of components, directives, and pipes that belong to this module. imports:  [ BrowserModule , SomeOtherModule] List of modules to import into this module. Everything from the imported modules is available to  declarations  of this module. exports:  [MyRedComponent, MyDatePipe] List of components, directives, and pipes visible to modules that import this module. providers:  [MyService, { provide: ... }] List of dependency inje
Recent posts

Angular - Testing

Testing This guide offers tips and techniques for unit and integration testing Angular applications. The guide presents tests of a sample CLI application that is much like the  Tour of Heroes  tutorial . The sample application and all tests in this guide are available for inspection and experimentation: live example  /  download example live example  /  download example Setup The Angular CLI downloads and install everything you need to test an Angular application with the  Jasmine test framework . The project you create with the CLI is immediately ready to test. Just run this one CLI command: content_copy ng test The  ng test  command builds the app in  watch mode , and launches the  karma test runner . The console output looks a bit like this: content_copy 10 % building modules 1 / 1 modules 0 active ... INFO [ karma ]: Karma v1 . 7.1 server started at http :// 0.0 . 0.0 : 9876 / ... INFO [ launcher ]: Launching browser Chrome ... ... INFO [ launcher ]: