Ashik Basheer
Ashik Basheer

Reputation: 1601

Can I use Angular1 plugin in Angular2 application?

I am very new to Angular 2 and would like to know if Angular 1 plugins can be used in Angular 2. I have used ng-knob in ionic 1 app. Some suggested to use jQuery knob instead but I really want to use ng-knob as it has many more options.

Is it possible to use ng-knob in angular 2? Even if there is a harder way I would not hesitate to try it but I really wan't to use ng-knob.

Any help with sample code is greatly appreciated.

Upvotes: 0

Views: 421

Answers (2)

Gary
Gary

Reputation: 2339

Check out the Upgrading with The Upgrade Adapter section in angular.io - point 2 and other sections till 8.

https://angular.io/docs/ts/latest/guide/upgrade.html

Use angular.umd.js file instead of angular.dev.js or angular.js for 2.x. It supports both angular1 application and angular2 application to run side by side. This way you can use 1.x plugin with angular 1.x application and still run angular 2.x application side by side. You can use Zone.js to merge two way binding between angular 1.x application and 2.x application.

But this can be complex and if you are not comfortable with advanced hacks, you should take the answer of using 1.x plugins in 2.x versions. Unless you are ready to port your 1.x plugin to 2.x plugin yourself.

Zone.js intro - https://www.youtube.com/watch?v=V9Bbp6Hh2YE Good resource from Misko.

Upvotes: 0

micronyks
micronyks

Reputation: 55443

As Angular2 framework is different from Angular1 framework, I'm afraid to say that you can't use Angular1 plugin(s) for Angular2.

Angular2 is a new framework and recently became stable. So, if you are looking for Angular2 plugin(s), its very hard to find them(as of now) as community is still developing Angular2 plugin(s).

Upvotes: 1

Related Questions