Skip to content

Instantly share code, notes, and snippets.

View techindepth's full-sized avatar
👋

ANISH ANTONY techindepth

👋
View GitHub Profile
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
template: `
<h1>My App</h1>
<nav>
<a routerLink="eager">Eager</a>
<a routerLink="lazy">Lazy</a>
</nav>
import { ModuleWithProviders } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { EagerComponent } from './eager.component';
const routes: Routes = [
{ path: '', redirectTo: 'eager', pathMatch: 'full' },
{ path: 'eager', component: EagerComponent },
{ path: 'lazy', loadChildren: 'lazy/lazy.module#LazyModule' }
];
import { Component } from '@angular/core';
@Component({
template: '<p>Eager Component</p>'
})
export class EagerComponent {}
import { NgModule } from '@angular/core';
import { LazyComponent } from './lazy.component';
import { routing } from './lazy.routing';
@NgModule({
imports: [routing],
declarations: [LazyComponent]
})
export class LazyModule {}
import { ModuleWithProviders } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { LazyComponent } from './lazy.component';
const routes: Routes = [
{ path: '', component: LazyComponent }
];
import { Component } from '@angular/core';
@Component({
template: '<p>Lazy Component</p>'
})
export class LazyComponent {}
public interface Selector {
public void registerObserver(Observer observer);
public void removeObserver(Observer observer);
public void notifyObservers();
}
public interface Observer {
public void update(String status);
}
import java.util.ArrayList;
import java.util.List;
public class FlipkartMINote5Pro implements Selector{
private List<Observer> observers = new ArrayList<Observer>();
private String productStatus;
public class AkhilCustomer implements Observer {
@Override
public void update(String status) {
if(status.equals("Available"))
System.out.println("Akhil: Its too Late, I am not planning to buy the phone!!!!");
}
}