angular 2 splice not reflecting on ui

I did something like this and it worked:

this.someJSONArray.splice(5, 1);
this.someJSONArray = JSON.parse(JSON.stringify(this.someJSONArray));

And it was being reflected on UI without any issues.

Angular 2 ngx typeahead not working in IE

Add below lines in your polyfills.ts

import 'core-js/es7/array';
import 'core-js/es7/string';
import 'zone.js/dist/zone';

String.prototype.normalize = function() { return String(this); };

Angular 2 handle browser refresh

*Follow the given steps:*

 - Put below line in your index.html page
   <base href="./index.html">

- Add useHash attribute in your app.module.ts like:
  RouterModule.forRoot([{ path: '**', redirectTo: 'product' }], { useHash: true })


Angular 2 http post example

You can create a simple HTTP Post service in Angular 2 like below:

import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders, HttpParams} from '@angular/common/http';
import { URLSearchParams } from '@angular/http';

@Injectable()
export class UserService {

       constructor(private http: HttpClient) {

        }

        public post(userObj) {
             return this.http.post('http://bospp.com/post', JSON.stringify(userObj) {
                 observe: 'response'
             });
        }
}

In Component you can call this service like:

@Component({
       selector: 'user-page',
       templateUrl: './user-page.html',
      providers: [UserService]
})


export class UserPage implements OnInit {

         constructor(private userService: UserService){

         }

         createUser() {
               let user = {
                    "firstName": "Rahul",
                    "lastName": "Jain"
               };
               this.userService.post(user).subscribe(resp => {
               user = resp.body['userObj'];
        }

}

angular 2 http get example

You can create a simple HTTP Get service in Angular 2 like below:

import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders, HttpParams} from '@angular/common/http';
import { URLSearchParams } from '@angular/http';

@Injectable()
export class UserService {

       constructor(private http: HttpClient) {

        }

        public get(id: string) {
             return this.http.get('http://bospp.com/get/' + id, {
                 observe: 'response'
             });
        }
}

In Component you can call this service like:

@Component({
       selector: 'user-page',
       templateUrl: './user-page.html',
      providers: [UserService]
})


export class UserPage implements OnInit {

         constructor(private userService: UserService){

         }

         getUser() {
               const userID = '101';
               let user = null;
               this.userService.get(userID).subscribe(resp => {
               user = resp.body['userObj'];
        }

}