Posts

How to focus on a particular input box on page load using Jquery?

To focus on first input box $(function(){ $("input")[0].focus(); }); To focus on second input box $(function(){ $("input")[3].focus(); }); To focus on a particular id of input box $(function(){ $("id1")[0].focus(); });

Child to parent component communication in angular 8

Parent component to child component interaction Child1 Component child1.component.ts => import  {  Component ,  OnInit ,  Output ,   EventEmitter  }  from   '@angular/core' ; @ Component ({   selector:  'app-child1' ,   templateUrl:  './child1.component.html' ,   styleUrls: [ './child1.component.css' ] }) export   class   Child1Component   implements  OnInit {   @ Output ()  public  childUsername  =   new   EventEmitter ();    fireEvent (){      this . childUsername . emit ( 'Hey! This is the Child component' );   }    constructor () { }    ngOnInit () {   } } child1.component.html => < div   class = "text-danger bg-success text-right mt-2 mb-2" ...

Parent to child component communication in angular 8

Parent component to child component interaction Parent Component parent.component.ts => import  {  Component ,  OnInit  }  from   '@angular/core' ; @ Component ({   selector:  'app-parent' ,   templateUrl:  './parent.component.html' ,   styleUrls: [ './parent.component.css' ] }) export   class   ParentComponent   implements  OnInit {  username :any   =   'this is the parent child' ;    constructor () { }    ngOnInit () {   } } parent.component.html => < div   class = "text-center  bg-primary text-white p-1 m-2" >    < H3 > PARENT TO CHILD COMPONENT COMMUNICATION  </ H3 >    < app-child   [uname] = 'username' >   </ app-child > </ div > ...

Creating Custom Pipes in Angular

Custom Age Pipe with source code implemetation==>   Create age pipe in pipes fder by following command in command terminal ng g p pipes/age age.component.ts => DateOfBirth =   new   Date ( '01/07/1990'  ); age.pipe.ts => import  {  Pipe ,  PipeTransform  }  from   '@angular/core' ; @ Pipe ({   name:  'age' }) export   class   AgePipe   implements  PipeTransform {    transform (value :   any ) :   any  {      console . log ( "print age pipe = "   +   value );      let   currentDate :any   =   new   Date (). getFullYear ();  // 2019      let   birthYear :any   =   new   Date ( value ). getFullYear ();      let   ageofMan :any   =    currentDate   - ...

How To Delete A Component In Angular

Steps to delete a component in Angular Remove the import line reference from Angular  app.module.ts  file. Remove the component declaration from @NgModule declaration array in  app.module.ts  file And then manually delete the component folder from Angular project. Finally Delete all the references of component manually from the Angular project. In Angular CLI,there is no command available to delete a component created by Angular CLI as of now. There is no ng delete component command as part of Angular CLI.

How to Create Shareable Download Links for Google Drive Files

First get sharable link grom google Drive , by right click on that file, you will get link like below:  drive.google.com/open?id=111111111 111111111 is the sample fileid. you have to convert this link to like: https://drive.google.com/ uc?export=download&id =111111111  In above line we just replaced  open?id by  uc?export=download&id   

Show/Hide DIV onRadio Buttons

<div class="container"> <p>Click to open div on radio button  </p>   <label class="radio-inline"><input type="radio" name="tab" value="igotnone" onclick="show1();" /> None</label>   <label class="radio-inline"><input type="radio" name="tab" value="igottwo" onclick="show2();" /> Two</label> <div id="div1" class="hide">   <hr><p>Okay Cool! Here is the DIV1...</p> <div class="card" style="width:400px">     <img class="card-img-top" src="https://www.w3schools.com/bootstrap4/img_avatar1.png" alt="Card image" style="width:100%">     <div class="card-body">       <h4 class="card-title">John Doe</h4>       <p class="card-text">Some example text...