Tuesday, October 10, 2017

Angular Notes

//Aceess Nested json

[HttpGet]
public HttpResponseMessage CM_Service()
{
try
{
var ExpertPanels = UserLookupBL.RADS_GetEpertPanelsGrid();
var PanelRoles = UserLookupBL.RADS_GetPanelRolesGrid();
var TopicRoles = UserLookupBL.RADS_GetTopicRolesGrid();

var data = new
{
RADS_ExpertPanels = ExpertPanels,
PanelRoles = PanelRoles,

};
if (ExpertPanels != null && PanelRoles != null)
{
return Request.CreateResponse(HttpStatusCode.OK, data);
}
else
{
return Request.CreateResponse(HttpStatusCode.NotFound);
}

}
catch (Exception ex)
{
return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex);
}
}

<ng-container *ngFor="let userLookup of CM_Service?.RADS_ExpertPanels |userLookupFilter:SearchText;">


How to concat new array value in existing array
arr1:[{}];
arr2:[{name:naveen}]

Array.prototype.push.apply(this.arr1,this.arr2);


how to access template elements in component.
<textarea #EditName cols="20" rows="4" class="form-control" formControlName="Name" ></textarea>

import { ViewChild, ElementRef, Renderer2 } from '@angular/core';
@ViewChild('EditName') element: ElementRef;
console.log(this.rd); //other way using renderer2
// alert(this.element.nativeElement.value);


How to Reset form values
this.lookupsForm.reset(); // in angular
$("#CreateForm,#EditForm").trigger("reset"); //in jquery
$('select').prop('selectedIndex', 0);



How to Hide/Show popup
// this.modal.dismiss();
// $("#myModal).modal("hide"); $("#create_modal").modal("show");


How to add jquery in TS
declare var $: any;

Multi cursor selection

This shortcut comes handy when you need to modify multiple lines together.
Mac: opt+cmd+up or opt+cmd+down
Windows: ctrl+alt+up or ctrl+alt+down
Linux: alt+shift+up or alt+shift+down

No comments:

Post a Comment

javascript Filter/index off

 var family = [{"name":"Jack",  "age": 26},               {"name":"Jill",  "age"...