Posts

Showing posts from March, 2019

Check Valid Email Address c#

private static bool IsValidEmailAddress(string EmailId) { const string pattern = @"^(?!\.)(""([ ^""\r\\ ]|\\[ ""\r\\ ]) *""|" + @"([-a-z0-9!#$%&'* +/=?^_`{|}~]|(? <!\.)\.)*)(?<!\.)" + @"@[a-z0-9][\w\.-]*[a-z0-9]\.[a-z][a-z\.]*[a-z]$"; var regex = new Regex(pattern, RegexOptions.IgnoreCase); return regex.IsMatch(EmailId); }

How to change angular port from 4200 to any other

The solution worked for me was ng serve --port 4401 (You can change 4401 to whatever number you want) Then launch browser ->  http://localhost:4401/

Could not find module "@angular-devkit/build-angular" from

Install  @angular-devkit/build-angular  as dev dependency. This package is newly introduced in Angular 6.0 npm install --save-dev @angular-devkit/build-angular or, yarn add @angular-devkit/build-angular --dev

Deploy Angular Application to Heroku

Image
Making use of the Angular CLI, setup a new project by running : ng new demo-deploy cd demo-deploy ng serve git remote add origin <new_github_repository_url> git add . git commit -m "initial commit" git push -u origin master Setup Automatic Deployment from GitHub     to Heroku: Go to   heroku website . Its free.  Login  to your dashboard and create a new app. Click  Create app Two more simple steps: 1.Under Automatic Deploys, select the master branch and click Enable Automatic Deploys. 2. Under Manual Deploys, click Deploy Branch. This is to push our fresh code to heroku. It might take a little while but will show you successfully deployed message once done. Configure Your Angular App to Deploy Properly on Heroku: Install them into your application by running this commands in your terminal: npm install @angular/cli@latest @angular/compiler-cli --save-dev Create pos...

Create, Read, Update and Delete angular Firestore | Angular 6

import { Injectable } from '@angular/core' ; import { AngularFirestore, AngularFirestoreCollection, AngularFirestoreDocument } from 'angularfire2/firestore' ; import { Observable } from 'rxjs/Observable' ; import { Employee} from '../model/Employee' ; @Injectable () export class EmployeeService { userscollection: AngularFirestoreCollection<Employee>; users: Observable<Employee[]>; userDoc: AngularFirestoreDocument<Employee>; constructor( public _afs: AngularFirestore) { } getData() { this .userscollection = this ._afs.collection( 'employees' , x => x.orderBy( 'firstName' , 'asc' )); this .users = this .userscollection.snapshotChanges().map( changes => { return changes.map( a => { const data = a.payload.doc.data() as Employee; data.id = a.payload.doc.id; return data; }); }); return this .users; } insertEmployee( employee : Employee) { this ._afs.collection( 'employees' )...