From 2dbd8cced59793858cb55e371685c0a2483527c2 Mon Sep 17 00:00:00 2001 From: Alik Chebotar Date: Wed, 6 Jun 2018 14:35:22 +0300 Subject: [PATCH] Angular 2/4/5/6 cheatsheet --- frontend/angular.js | 346 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 346 insertions(+) create mode 100644 frontend/angular.js diff --git a/frontend/angular.js b/frontend/angular.js new file mode 100644 index 0000000..102bfd5 --- /dev/null +++ b/frontend/angular.js @@ -0,0 +1,346 @@ +/* ******************************************************************************************* + * ANGULAR CHEATSHEET + * DOCUMENTATION: https://angular.io/docs + * STYLE GUIDE: https://angular.io/guide/styleguide + * ******************************************************************************************* */ + +``` +npm install --save @angular/cli // declarative and flexible JavaScript framework for building UI +ng serve // serve the app +ng build // build the release +``` + +/* ******************************************************************************************* + * 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 injection providers visible both to the contents of this module and to importers of this module. + +bootstrap: [MyAppComponent] +// List of components to bootstrap when this module is bootstrapped. + + +/* ******************************************************************************************* + * Template syntax + * ******************************************************************************************* */ + +// +// Binds property value to the result of expression firstName. + +//
+// Binds attribute role to the result of expression myAriaRole. + +//
+// Binds the presence of the CSS class extra-sparkle on the element to the truthiness of the expression isDelightful. + +//
+// Binds style property width to the result of expression mySize in pixels. Units are optional. + +//