Skip to content

Instantly share code, notes, and snippets.


Dhananjay Kumar debugmodedotnet

View GitHub Profile
View paginatior.ts
import { Component, OnInit } from '@angular/core';
import { CourseCatalogService } from '../shared/coursecatalog.service';
import { NavigationExtras, Router, ActivatedRoute } from '@angular/router';
selector: 'app-catalog',
templateUrl: './catalog.component.html',
styleUrls: ['./catalog.component.css']
View talk.txt
Title: Simplifying Dependency Injection in Angular
Dependency Injection is one of the most famous architecture patterns to create a scalable application that has loosely coupled entities such as classes. Application made using the DI pattern is highly loosely coupled, and any part such as the business logic layer of application can be replaced at the run time without affecting the presentation layer. By design Angular framework supports dependency injection. It enables you to inject dependencies such as services without writing your own DI container or refereeing to any third-party libraries.
You create a service in Angular to share data and operations between components, directives etc. Mainly services are used to achieve separation of concerns and reusability. You keep operations such as API calls, logging, client-side data manipulations, etc. in a service. One of the significant purposes of creating service is to keep component clean that focuses on user interaction and presentations.
So, if you create
View gist:dee70a3e3b13a92b8d216deb4db69fe1
const domino = require('domino');
//const domino = require('@angular/platform-server/node_modules/domino');
const fs = require('fs');
const path = require('path');
const template = fs.readFileSync('dist/active-directory-javascript-singlepageapp-angular/browser/index.html').toString();
const win = domino.createWindow(template);
global['window'] = win;
global['document'] = win.document;
global['DOMTokenList'] = win.DOMTokenList;
global['Node'] = win.Node;
View test1.js
import { Component, OnInit } from '@angular/core';
selector: 'app-learningapproach',
templateUrl: './learningapproach.component.html',
styleUrls: ['./learningapproach.component.scss']
export class LearningapproachComponent implements OnInit {
constructor() { }
View unityresolver.cs
public class UnityResolver : IDependencyResolver
protected IUnityContainer container;
public UnityResolver(IUnityContainer container)
if (container == null)
throw new ArgumentNullException("container");
View c1.cs
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using System.Web.Http.Description;
View cdchild.js
import { Component, OnInit, Input, ChangeDetectionStrategy, OnChanges, ChangeDetectorRef } from '@angular/core';
import { Observable } from 'rxjs';
import { TouchSequence } from 'selenium-webdriver';
selector: 'app-child',
template: `
<h2>Items : {{_data.counter}} </h2>
<button (click)='0'>Refresh</button>
View tshirt2.ts
import { EventEmitter, Component, OnInit, Input, OnChanges, ChangeDetectionStrategy, SimpleChange, Output } from '@angular/core';
selector: 'app-child',
styleUrls: ['./app-child.component.css']
View tshirt1.ts
import { Component, OnInit } from '@angular/core';
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
export class AppComponent implements OnInit {
View demo2.html
<div class="card text-center">
<img class="img-fluid" [src]="tshirt.fimage"/>
<div class="card-header">
<button (click)='cancel()' type="button" class="close" aria-label="Close">
<span aria-hidden="true">&times;</span>
<div class="card-body">
You can’t perform that action at this time.