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 🙏

© 2024 – Pkg Stats / Ryan Hefner

angular2to1

v0.1.2

Published

An angular 2 to angular 1 shim tool to start writing angular 2 component syntax with angular 1

Downloads

19

Readme

Build Status

angular2to1 Project

An angular 2 to angular 1 Shim - Write angular 2 components with angular 1.
As explained in my blog post: Write Angular 2 Components In Angular 1.

Install

via npm:
npm i angular2to1 --save-dev

Usage

in browser, include the dist/angular2to1.min.js (or ./index.js)

Why

An angular 2 to angular 1 function. This function should provide ES5 syntax of angular v2 to be used with angular 1 reasons:

  1. You want to learn angular 2 syntax
  2. You still want to develop with angular 1
  3. You want to ease migration (when possible) of angular 1 to 2

Examples

This code eventually defines an angular.js version 1.x module, directive and controller:

var myApp = ng.core
	.Component({
		selector: 'my-app'
		providers: [ 
			'core.services'
		],
		bindings: {
			title: '@'
		}
	})
	.View({
		template: '<div> {{ myApp.title }} </div>'
	})
	.Class({
		constructor: 'MyAppCtrl'
	})

Consume the new module in your and include it:

angular.module('app', [
	'my-app'
])
// or if you're using commonjs
angular.module('app', [
	require('my-app').name
])

Simply, use the module in html:

<my-app title="my-player"></my-app>

API

  1. Component - a component is an element by default
  2. selector - of element - <my-app></my-app> - defined as 'my-app'
  3. selector - of attribute - <div tooltip></div> - defined as '[tooltip]'
  4. "controllerAs" inside the template follows the camel-case module name. i.e. - if selector: 'my-app', then, the controllerAs is: myApp (as in angular 2 Beta). You can pass a custom controllerAs alias in the Component's options.

Install

use npm:

npm install angular2to1 --save