Showing posts with label Angular 2. Show all posts
Showing posts with label Angular 2. Show all posts
Sunday, April 22, 2018
Tuesday, August 8, 2017
Thursday, June 1, 2017
Wednesday, May 24, 2017
Thursday, April 13, 2017
Wednesday, April 12, 2017
String Manipulation ( Change first letter to Uppercase )
Angular function for converting the first letter to uppercase
firstNameToUpperCase(value:string){ //Check if the value exists if(value.length > 0) { //Fetch the first character and turn it into upper and leave the rest this.userModel.firstName=value.charAt(0).toUpperCase() + value.slice(1); } else { this.userModel.firstName=value; } }
Quick reference for Angular 2 changes
Changes in Angular 2 compared to angular 1
- Ngref= href property binding. Browser module has definition to *ngref. Any directive that changes the directive is known as structural directive
*ngFor - No watchers and No digest cycle
- Binding syntax has been changed
- Property binding is done using [ ]
Friday, March 3, 2017
Nested component angular 2
For creating nested component we need to create the component under the shared folder.
When we use a component as a directive, we need to tell angular how to find that directive.We do that by declaring the nested component in an angular module as shown below
In the import we need to specify the path of the file and then add it in the declarations with the ngModule
When we use a component as a directive, we need to tell angular how to find that directive.We do that by declaring the nested component in an angular module as shown below
In the import we need to specify the path of the file and then add it in the declarations with the ngModule
import { StarComponent } from './shared/star.component'; @NgModule({ imports: [ BrowserModule,FormsModule ], declarations: [ AppComponent , UserComponent, ProductListComponent, ProductFilterPipe, StarComponent], bootstrap: [ AppComponent ] })
Monday, February 13, 2017
Angular 2 HTTP Requests with Observables
We use an http client to talk to a remote server.
- The Angular Http client communicates with the server using a familiar HTTP request/response protocol. The Http client is one of a family of services in the Angular HTTP library.
- Before you can use the Http client, you need to register it as a service provider with the dependency injection system.
Subscribing to an observable in angular2
- Observable are similar to promises but with major difference that make them better.
- Observables is an ES7 feature which means you need to make use of an external library to use it today. RxJS is a good one. RxJS also provides Observable operators which you can use to manipulate the data being emitted. Some of these operators are:
Saturday, January 28, 2017
Wednesday, January 25, 2017
Strongly typed Angular 2 components
Typescript, is a typed superset of the JavaScript language that is compiled to produce clean, simple cross-browser compatible JavaScript code, which can help when building and maintaining large-scale applications. Typescript has features of ES6 such as interfaces, classes and modules.
Note: To specify custom typing we can use an interface
In this example we have specified custom type for address using an interface.
Subscribe to:
Posts (Atom)
Labels
- Algorithms (52)
- Apache Kafka (7)
- Apache Spark (21)
- Architecture (8)
- Arrays (23)
- Big Data (98)
- Cloud services (6)
- Cognitive technologies (12)
- Data Analytics (3)
- Data Science (6)
- Design (1)
- Hadoop (26)
- Hive (11)
- Java (2)
- JavaScript (65)
- JavaScript Run-time (12)
- Machine learning (11)
- Maths (6)
- MySQL (1)
- Networking (3)
- No SQL (2)
- Node (20)
- Python (28)
- SQL (40)
- Security (4)
- Spark Grpahx (1)
- Spark MLlib (1)
- Spark Sql (3)
- Spark Streaming (4)
- Sqoop (2)
- Strings (13)
- devOps (1)
- mongoDb (2)
- ssis (3)


