In this short post, find out how to bind click event in Angular 2. ngClick
is used in Angular 1.x to bind the click event but things changed in Angular 2. One of the major change in Angular 2 is, that it directly uses the valid HTML DOM element properties and events. So take the HTML event and wrap it with parentheses. So with Angular 2, use (click)
to attach a click event in Angular 2. Read difference between Angular 1.x and Angular 2 to know more about other differences. Read More
Category: Angular 2
Bind RadioButton List in Angular 2
Earlier I posted about how to bind Select DropDown List in Angular 2 and Cascading DropDown List using Angular 2 covering some of the newest features of Angular 2 beta 8 release. And in this post, we will find out how to bind radiobutton list in Angular 2. At the time of writing this post, Angular 2 RC4 is the newest version.
Angular CLI is here for Angular 2
Setting up Angular 2 in your application is quite time-consuming compare to AngularJS 1. For setting up Angular 1.x, all you need to do is to just add the reference of library but with Angular 2, it requires some more work due to dependency on Grunt or Gulp for build process, TypeScript and it’s compiler. And setting this with Visual Studio 2015 is even more time-consuming. Angular Team is aware of this and they came up with a solution and introduced a new command line tool (cli) for Angular 2. Yes, Angular CLI is here for Angular 2 applications.
Read More
Cascading DropDown List with ASP.NET Core WEB API and Angular 2
Earlier I posted about Cascading DropDown List using Angular 2 and in this post, we take it to next level and implement it with ASP.NET Core Web API and Angular 2. But starting/configuring AngularJS 2 with ASP.NET Core is not straightforward and it requires some manual configurations to be done. If you are not sure how to do it, I recommend you to read this helpful post to find out post how to start with Angular 2 in ASP.NET Core with TypeScript using Visual Studio 2015.
Read MoreDon’t use hidden attribute with Angular 2
As explained earlier in this post, Angular 2 directly uses the valid HTML DOM element properties and events unlike AngularJS 1.x pre-defined directives. So in place of ng-href
, ng-src
, ng-show
and ng-hide
, Angular 2 uses href
, src
and hidden
properties to get the same result. But don’t use hidden attribute with Angular 2 to show/hide elements. Let me tell you WHY?
Cascading DropDown List using Angular 2
Previously I posted about how to bind dropdown/select list in angular 2 and in this post, we shall find out how to create cascading dropdown list using Angular 2 by enhancing the same country list Angular 2 application.
Bind Select DropDown List in Angular 2
Earlier I posted about the differences between AngularJS 1.x and Angular 2 in which I tried to explain how things changed with respect to Angular 2.In this post, we’ll find out how to bind select dropdown list in Angular 2. Read More