Pages

Showing posts with label AngularJS. Show all posts
Showing posts with label AngularJS. Show all posts

Friday, 6 July 2018

AngularJS : Using $http service to get JSON data


No. Name Rate
{{ $index + 1 }} {{x.name}} {{x.rate}}
  • {{ x.name + ', ' + x.rate }}

Thursday, 5 July 2018

AngularJS : $interval Service Example


The time is:

{{ theTime }}

The $interval service runs a function every specified millisecond.

AngularJS: ServerData

Hello AngularJS programmers ...

AngularJS : Sort an Array Based on User Input

Click on the table header name to sort the data.

Name Country
{{x.name}} {{x.country}}

AngularJS - Filter an Array Based on User Input

This is one of awesome features of AngularJS filter. We can filter an array of data based on user input.

For example:
Type a letter in the input field:

  • {{ x }}

Use filter in AngularJS directive

Let's say we have this raw data :

$scope.names = [
        {name:'Jani',country:'Norway'},
        {name:'Carl',country:'Sweden'},
        {name:'Margareth',country:'England'},
        {name:'Hege',country:'Norway'},
        {name:'Joe',country:'Denmark'},
        {name:'Gustav',country:'Sweden'},
        {name:'Birgit',country:'Denmark'},
        {name:'Mary',country:'England'},
        {name:'Kai',country:'Norway'}
        ];


<ul>
  <li ng-repeat="x in names | orderBy:'country'">
    {{ x.name + ', ' + x.country }}
  </li>
</ul>

Example:
Looping with objects:
  • {{ x.name + ', ' + x.country }}

Use AngularJS ng-click event in Blogger Example

This post embedded AngularJS code to demonstrate the use of ng-click.

Klik sini kalau berani >> {{firstname}}