Monday, October 29, 2018

Unable to apply changes on device: emulator-5554. Error is: Socket connection timeouted..

Unable to apply changes on device: emulator-5554. Error is: Socket connection timeouted..

Solution is ...
 First need to remove old app from emulator then close it down and then try


> tns run android --bundle  in native script 

Friday, September 14, 2018

How Nesting Routing Works in .Angular 6

    • Adding the base href in index
    • router-outlet in app component
    • and Routing module to main module
For Further info check official Docs
import { NgModule } from ‘@angular/core’;
import { CommonModule } from ‘@angular/common’;
import { RouterModule,Routes} from ‘@angular/router’;
import { HomeComponent} from ‘../layout/home/home.component’;
import { WatchComponent} from ‘../layout/watch/watch.component’;
import { AdminComponent} from ‘../layout/admin/admin.component’;
import { AdminDetailsComponent} from ‘../layout/admin/admin-details/admin-details.component’;
import { AdminListComponent } from ‘../layout/admin/admin-list/admin-list.component’;
const routes:Routes = [
{
path:”,
component: HomeComponent
},
{
path:’watch’,
component: WatchComponent,
children:[
{
path:”,
component: AdminDetailsComponent
}
]
},
{
path:’watch/admin’,
component: AdminComponent,
children:[
{
path:”,
component: AdminDetailsComponent
},
{
path:’list’,
component: AdminListComponent
},
]
}
]
@NgModule({
imports: [
CommonModule,
RouterModule.forRoot(routes)
],
declarations: [],
exports:[
RouterModule
]
})
export class RoutingModule { }
Check the online edit link

Thursday, July 12, 2018

How Angular Filter Transformation from angular Js to Angular ( Js to TypeScript)

Angular Filter Transformation from angular Js to Angular ( Js to TypeScript)




$scope.sel_view = $filter('filter')($scope.list, function(value) {  return value.viewSeq == seq;})[0];

this.sel_view = this.viewList.filter((view: any) =>{  return view.viewSeq == seq ;})[0];

Tuesday, June 26, 2018

Error : Argument of type '{ headers: HttpHeaders; responseType: string; }' is not assignable to parameter of type '{ headers?: HttpHeaders | .......

If You have this error in angular request for response type "text",


Argument of type '{ headers: HttpHeaders; responseType: string; }' is not assignable to parameter of type '{ headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "bod
y"; params?: Ht...'.


You need to set header from .... 


    let headers = new HttpHeaders({
        'Content-Type': 'application/json',
        'Authorization': window.sessionStorage.token
      });
      let authHttpOptions = {
       headers : headers,
        responseType: 'text'
      }


       this.http.post(url, param, authHttpOptions)
          .subscribe(..)



to 
 this.http.post(url, param, {
          headers: new HttpHeaders({'Content-Type': 'application/json', 'Authorization': window.sessionStorage.token}),
          responseType : 'text'
 })
          .subscribe( ...)