# angular2to1

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

Latest version **0.1.2** (published 2015-12-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install angular2to1
pnpm add angular2to1
yarn add angular2to1
bun add angular2to1
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2015-12-29 |
| First published | 2015-07-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 (+10 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Oren Farhi |
| Maintainers | orizens |
| Keywords | angular, angular2, shim |

## Links

- npm: https://www.npmjs.com/package/angular2to1
- Repository: https://github.com/orizens/angular2to1
- Issues: https://github.com/orizens/angular2to1/issues
- npm.io page: https://npm.io/package/angular2to1

## Dependencies (1)

- [angular](https://npm.io/package/angular.md) ^1.4.7

## Recent versions

- 0.1.2 (latest) — 2015-12-29
- 0.1.1 — 2015-12-16
- 0.1.0 — 2015-12-16
- 0.0.9 — 2015-11-24
- 0.0.82 — 2015-11-01
- 0.0.81 — 2015-11-01
- 0.0.8 — 2015-11-01
- 0.0.7 — 2015-10-25
- 0.0.6 — 2015-10-13
- 0.0.5 — 2015-07-15
- 0.0.4 — 2015-07-09
- 0.0.3 — 2015-07-09
- 0.0.2 — 2015-07-09
- 0.0.1 — 2015-07-09

## README

[![Build Status](https://travis-ci.org/orizens/angular2to1.svg)](https://travis-ci.org/orizens/angular2to1)

# 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](http://orizens.com/wp/topics/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:  
```javascript
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:
```javascript
angular.module('app', [
	'my-app'
])
// or if you're using commonjs
angular.module('app', [
	require('my-app').name
])
```
Simply, use the module in html:  
```html
<my-app title="my-player"></my-app>
```
## API  
1. Component - a component is an element by default  
  1. selector - of element - ```<my-app></my-app>``` - defined as ```'my-app'```  
  1. selector - of attribute - ```<div tooltip></div>``` - defined as ```'[tooltip]'```   
1. "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
```

---
_Source: https://npm.io/package/angular2to1 · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
