Angular 2 syntax helpers for Angular 1.2 - angularjs

My application is in angular version 1.2. We are planning to make any new changes using typescript and angular 2 syntax helpers (like ng-metadata or angular2-now)
Unfortunately the above syntax helpers only works for angular version 1.4+. Is there any such helpers available for angular 1.2?

try this Angular-Typescript project on github, and my advice is to updated your project to 1.4 or above to make it easier for you!

Related

Can we use es6 with AngularJS

I'm working on an angularJS website and i wanna know if we can code in es6 natively (we use babel now) since the web browsers support es6.
Thanks,
Marius
EDIT: i use AngularJS 1.5.8

Integration of "angular-cron-jobs" with the latest Angular 2 Applications

Anytime I import this module "Angular-cron-jobs" in the Ionic 2 / Angular 2 using the ngModule decorator, I get the
"angular is not a function".
Is there a way around this or is there an angular2 version of this module?
"angular-cron-jobs" is a cron job UI directive from https://github.com/angular-cron-jobs but I noticed it's written in angular 1.*
How can I get it to work or is there a similar module doing the same thing? Thanks in advance.

How to setup angularjs 1.5.x work with systemjs and typescript

I want to keep all my code still in 1.x and also want code is easy to upgrade to angularjs 2 latter. To make my code follow angular 2 style, I want to work with typescript and systemjs in 1.5.x firstly.
Does anyone have a work-around/code on how to setup angularjs 1.5.x work with systemjs and typescript?
This is the best match I found use babel as compiler: https://github.com/swimlane/angular1-systemjs-seed
But I want systemjs works together with typescript in angular 1.
There are some seed projects to get you started with angular and jspm (es6):
https://github.com/angularclass/NG6-starter/tree/jspm
https://github.com/davinkevin/angularjs-jspm-seed
This one is for jspm + typescript
https://github.com/b091/ts-skeleton/

angular 2 with modules from angular 1

Using angularjs 2 with typescript don't know how to use angular 1 modules like ui-grid or fullcalendar.
I can add module ui-grid with typescript?
Have a look at the migration guide:
AngularJS 1 to Angular 2 Upgrade Strategy
, and specifically this section: "Wrapping: AngularJS 1 to Angular 2"
You might also find this post useful: Angular 1 and Angular 2 integration: the path to seamless upgrade
PrimeNG provides FullCalendar integration and a DataTable, code is open source so you can review how the integration is done. DataTable is native though. http://www.primefaces.org/primeng/#/schedule

Use AngularJS (Angular1) module from Angular2 project

Just started a demo Angular2 project (no previous experience with Angular1/AngularJS. Have followed and extended from the online quickstart and tutorials, and all was fine. However I'm at the point where I would like to use some components from a library which is designed for AngularJS, and having no end of problems!
Most of the information available about AngularJS/Angular2 compatibility assumes that you have an AngularJS project that you're adding Angular2 components to - not the other way around - so what I'm hoping to do may not even be possible. What I've tried so far involves a simple stripped-back project based on the Angular2 quickstart, with a single Angular2 component that loads into the index.html. I'd then like to integrate components from the existing library (AngularJS-based) into this.
I've tried using UpgradeAdapter.upgradeNg1Component to create components from the library and add them directly into my Angular2 component
I've tried installing angularjs through npm, importing it in a script tag into my index.html and then using a combination of UpgradeAdapter.downgradeNg2Component and UpgradeAdapter.bootstrap to load my Angular2 as a downgraded module
Neither of these seem to work - the component fails to show, and the browser console tells me I've got an Uncaught SyntaxError: Unexpected token <
Evaluating http://localhost:3000/angular2/upgrade
Error loading http://localhost:3000/app/main.js
My best guess at the moment is that this is actually an unsupported scenario, and I need to have a 'proper' AngularJS app in order to use the UpgradeAdapter functionality from Angular2. Can anyone confirm this? Or is there something stupid I'm missing here?
Here is a working plunkr describing how to mix Angular1 and Angular2 elements:
http://plnkr.co/edit/yMjghOFhFWuY8G1fVIEg?p=preview
An important point is to bootstrap your main component on the UpgradeAdapter. This way all elements are available in providers (services / factories) and in directives (components / directives):
upgrade.bootstrap(document.body, ['heroApp']);
These two answers could help you:
angular 1.x and angular2 together
How to inject upgraded Angular 1 service/factory to Angular 2 component in ES5?
So the major problem in this case turned out to be the fact that it appears that the upgrade components aren't included as part of the basic angular 2 bundle. After adding:
<script src="node_modules/angular2/bundles/upgrade.min.js"></script>
to my index.html file the error I was seeing disappeared.
Thanks to the answer here for pointing me in the right direction!

Resources