Angularjs

Angular 6 Group Items in Select

Show option group in Angular with select and align group items properly. There is nothing special to Angular if you already know the ngFor loop. You are just missing the HTML part `optgroup`. We are going to see some working examples by using JSON data to show, you can use any service or data from anywhere. First we will see some pure HTML examples with hard coded values so we can understand... By Ali Adravi   On 04 Apr 2019  Viewed: 16,571
  • angularjs;
  • select
  • gourp

Global error handling in angular 6 with HttpClient & interceptor

Angular 4.3.1 introduced HttpInterceptor, we will use HttpClient and new HttpInterceptor feature to handle error globally for entire application. When calling the service method, we might get some kind of server error. It can be any kind, like poor network connection to reach to the server, method itself through error due to any logical error, or unable to connect to the database, in that... By Ali Adravi   On 10 Aug 2018  Viewed: 16,843
  • angular
  • angularjs
  • httpclient
  • httpinterceptor

Angular 5 email & compare password validation, different ways

Angular email validation can be done in many different ways, by using the built-in directive, by using patterns or by creating custom directive. In this article we will try to see all the three different ways with working code in plunker. We will use our previous example and add three email text boxes to validate 1. by built-in directive, 2. by using pattern and finally we will write our own... By Ali Adravi   On 23 Jan 2018  Viewed: 16,325
  • Angular-5
  • angularjs
  • custom-directive
  • compare-validation

angular 5 form validation easiest way

Angular make form validation easier than ever, we are going to check with Angular FormBuilder, FormGroup and validation together in this article, We will also see how to validate email without writing any custom directive or any other code because it is already there. Some tricky way to show and hide the error on page load and on save. We will use plunker for example: First we need to update... By Ali Adravi   On 23 Jan 2018  Viewed: 3,666
  • angular-5
  • angularjs
  • validation
  • FormGroup
  • ReactiveForm

Angularjs jQuery UI Datepicker disable dates conditionally

Angularjs jquery calendar with minimum code to attach datepicker, how to extend to restrict the dates from a particular day, month or year, how to make calendar to validate start and end date from one control to other after user selection, how to format date before rendering or how to disable datepicker with the help of angular ngDisabled properties are some of the common points we are going to... By Ali Adravi   On 26 Dec 2017  Viewed: 5,173
  • angularjs
  • jquery
  • datepicker
  • validation

Angularjs reusable Component with demo

Angularjs 1.5 introduced component which can be used for reuseable component similar to user control in ASP.Net. We will create a component and see how we can use with different pages by just adding a single element. If we will try to creat the same as a directive then will be complicated but with component it will be very easy. **Advantages of Components**: - simpler configuration than... By Ali Adravi   On 23 Oct 2017  Viewed: 2,645
  • angularjs
  • component

Angularjs checkboxlist required validation with demo

Checkbox list at least one is required, checkbox list minimum 3 is required, gender at least one is required are the basic requirement for any situation. We will use the toggle trick to add remove the selected items from the list of checkbox values. In this article we are going to see the examples: 1- Radiobutton list, at least one value is required 2- Checkbox list, at least one value... By Ali Adravi   On 22 Oct 2017  Viewed: 7,803
  • angularjs
  • checkbox-list

Angularjs render any json to table, add edit remove rows and more

Dynamic table rendering, edititing, adding/removing rows with angularjs, render any json script in tabular format with heading and contents. W will try to render dynamic table, add & remove rows, edit rows in table all by very simple coding, hardly two to five lines, don't allow to remove the first row and keep the add button always in the last row etc. 1. Angularjs Render any json array to... By Ali Adravi   On 07 Oct 2017  Viewed: 8,480
  • angularjs
  • dynamic-table

Angular component communication by using Input Output decorator

@Input and @Output decorator ar used to pass data/communicate between components, @input is used to pass data from parent to child component on the other hand @Output is use to notify the parent by using EventEmitter. Take the simple example of customers list parent page and add/edit child component, on clicking the edit button current customer data need to be passed to the child component to... By Ali Adravi   On 30 Sep 2017  Viewed: 2,107
  • angular2
  • angularjs
  • input
  • output

Angular 4 upload files with data and web api by drag & drop

Upload file with data by clicking on button or by drag and drop, is the topic of this article. We will try to create an image gallery by uploading files and save data into database and images into a folder. We will try to create a component in a way that it can be used anywhere in entire application and configure properties like file size, type of files, single or multiple files, maximum number... By Ali Adravi   On 24 Sep 2017  Viewed: 40,971
  • angular2
  • angularjs
  • web-api

Angular 2 CRUD with Web API 2

Angular 2 insert update, delete, search, sort feature we will try in this article which we will improve with dynamic component loading and image upload with drag and drop feature in coming articles with the same base code. We are going to use Angular-CLI 4 for this application. What we need to start: - Node version 6.x - Any code editor, I use Visual Studio Code, it is free - Angular... By Ali Adravi   On 03 Sep 2017  Viewed: 25,716
  • angular2
  • Angularjs
  • Web API

Angular 2 Dynamically Add & remove Components

Angular 2 gives full control to add or remove component in other component programmatically by simple steps. In this article we are going to see how to add, remove experience component to any other component, we will also try to pass some values to component from parent to child component to see if it is possible or not. It's better to write on plunker so we can test at anytime from... By Ali Adravi   On 27 Aug 2017  Viewed: 50,294
  • angular2
  • angularjs

Angular 2 Accordion expand only one at a time

Createing accordion demo in Angular 2 is more than easy, Angular have rich of conditional features which we will see in this article, like how to apply more than one class on the basis of some conditional values. For this demo we are not goign to write some fancy CSS and animation but use the hard coded data and use ngFor loop and index to create dynamically our list of items in accordion and... By Ali Adravi   On 19 May 2017  Viewed: 11,878
  • angular2
  • angularjs
  • accordion
  • bootstrap

Angular 2 Search and Sort with ngFor repeater with example

In angular 2 we don't have pre-defined filter and order by as it was with AngularJs, we need to create it for our requirements. It is time killing but we need to do it, (see [No FilterPipe or OrderByPipe][1]). In this article we are going to see how we can create filter called pipe in angular 2 and sorting feature called Order By. Let's use a simple dummy json data array for it. Here is the json... By Ali Adravi   On 16 Apr 2017  Viewed: 83,687
  • angular-2
  • angularjs
  • pipe
  • filter

Angularjs filter by multiple property in controller, ignore case

Angularjs Filter is very really handing when we need to filter records from a complex object array. I was looking Angular way to filter my records and found some interesting things from different websites, which I will try to summarise and explain in more detain in this article. We will see how to use filter in ngRepeat, ngOption and inside our controller because using filter in controller is a... By Ali Adravi   On 30 Jan 2017  Viewed: 23,177
  • angularjs
  • filter

Dynamic Angular Forms Validation in ngRepeat with ngMessage and live demo

Validation of controls in ng-repeat is really easy, just we need a unique name for every control. I found many articles which use ngMessage but they validate all the controls together, if there is any invalid control, all the controls say the error message. I was in need to explore and try different tricks and found one easy way, which I want to share to same others time. In this article we are... By Ali Adravi   On 20 Jan 2017  Viewed: 5,538
  • angularjs
  • ngMessage

Angularjs Multiple master pages with different design without show hide

Multiple master page in AngularJS is easy but it is not very straight forward in any documentation. Most of the people say no it is not feasible, some suggest to user different techniques which doesnot work for me. I try hard to find any quick solution but spend two days trying different suggestion for different people. After all decided to try my own so start exploring UI-Router in more... By Ali Adravi   On 03 Nov 2016  Viewed: 8,012
  • angularjs
  • ui-router
  • master-page

Angularjs Validation with CSS and ngMessage with Demo

Angularjs ngMessage validation is so powerful that we can complete our validation without writing any code except two simple CSS class and with great look and feel. By using ngMessage we can give those features which was taking months to wring css and JavaScript but with angularjs it is only the elements settings. In this article we will first try to understand the very simple CSS style then we... By Ali Adravi   On 06 May 2016  Viewed: 2,334
  • angularjs
  • ngMessage
  • Validation

Angularjs directives fundamentals

In AngularJS Directives are html markers on a DOM element like an attribute, element name, comment or CSS class, that tell AngularJS's HTML compiler ($compile) to perform a specified behaviour to that DOM element or even transform the DOM element and its children.Some Example are ngBind, ngModel, and ngClass etc. All the AngularJS pre-defined directives prefix with `ng`. AngularJS allow us to... By Ali Adravi   On 16 Mar 2016  Viewed: 884
  • angularjs
  • directives
  • restrict

Pass value from one controller to another in AngularJS

Share value between two or more controller is easy by using the service which we will see in this article. In ASP.Net there were many options to pass values from one page to other pages, let's just name some of them to understand if we can use them or not. The very first thing comes in mind SESSION state, to use the session state we will to go to the server side, so we will need the service to... By Ali Adravi   On 02 Nov 2015  Viewed: 27,579
  • service
  • angularjs
  • controller
12