npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

angular2-polyfill

v0.0.32

Published

Angular2 polyfill for Angular1

Downloads

54

Readme

angular2-polyfill Build Status

Angular2 polyfill for Angular1

Please note, this is a work in progress library

Install

$ npm install --save angular2-polyfill

Or with jspm

$ jspm install npm:angular2-polyfill

Usage

AppComponent

The AppComponent is the base component for our entire application. The following content is stored in components/app/app.component.ts. Because we are using ui-router, the only thing we add as a template is the place where the views should be rendered.

import {Component} from 'angular2-polyfill/core';
import {RouteConfig} from 'angular2-polyfill/router';
import {HomeComponent} from '../home/home.component';

@Component({
    selector: 'my-app',
    template: '<div ui-view></div>'
})
@RouteConfig([
    { path: '/', component: HomeComponent, name: 'Home', useAsDefault: true }
])
export class AppComponent {

}

HomeComponent

The HomeComponent simply renders the title defined in the class. Please note that in the background, we use the controllerAs syntax. The value of this property is consistent with the Angular 1.5 component value. The following content is stored in components/home/home.component.ts.

import {Component} from 'angular2-polyfill/core'

@Component({
    selector: 'home',
    template: '<h1>{{ $ctrl.title }}</h1>',
	styles: [`
		h1 {
			color: red;
		}
	`]
})
export class HomeComponent {
    private title: string = 'Hello World';
}

Bootstrapping

Use the bootstrap method from the upgrade platform. This allows you to rewrite your entire application at your own pace. It accepts the base angular module as first argument, and the component/service/... as second argument. This way, you can keep the other component as they are now and refactor them in the future.

import * as angular from 'angular';
import 'angular-ui-router';
import 'reflect-metadata';
import {bootstrap} from 'angular2-polyfill/platform/upgrade';
import {AppComponent} from './components/app/app.component';

const ngModule = angular.module('angular2-polyfill', ['ui.router']);

bootstrap(ngModule, AppComponent);

Note: The HomeComponent is being bootstrapped automatically because it is referred to in the @RouteConfig decorator of the AppComponent.

index.html

<html>
<head>
    <meta charset="utf-8">
</head>
<body>
    <my-app></my-app>

    <script src="jspm_packages/system.js"></script>
    <script src="config.js"></script>
    <script>
    System.import('app')
        .then(null, console.error.bind(console));
    </script>
</body>
</html>

We are using SystemJS as module loader. Feel free to use something else.

Decorators

  • @Component
  • @Directive
  • @RouteConfig
  • @Injectable
  • @Inject
  • @Optional
  • @Pipe

Pipes

  • AsyncPipe

Services

Core

  • EventEmitter

DI

  • Injector

HTTP

  • Http

Routing

  • Router
  • RouteParams

Functions

  • provide

Lifecycle hooks

  • ngOnInit
  • ngOnDestroy

Examples

GitHub

Plunks

License

MIT © Sam Verschueren