Join the Stack Overflow Community
Stack Overflow is a community of 6.5 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

I just want to know that, is it possible to create pluggable component in Angular 2 with Typescript for JavaScript project? I know that any JavaScript code is valid Typescript code, but what if you have already developed your JavaScript(ES5) project, and you want certain modules like Drag-Drop Module or Form Validator Module or Multiple Choice Questions(MCQ) Module (Developed in Angular 2 TS) for existing project?

I really don't know whether Angular 2(Typescript) is really suitable to such kind of pluggable module creation or not? OR is it like that, Angular 2 is used for creating SPAs only?

Since Angular 2 components have their own life-cycle and JavaScript functions executes sequentially. then how the co-ordination possible?

If you know any kind of example(if it is possible) the please help me out? I'll really appreciate your responses!! (I tried on the net but didn't get any proper solution)

share|improve this question

You can develop Angular2 components and directives to be used in other Angular2 applications. Angular2 is not suitable to build libraries for plain JavaScript applications.

You can use TypeScript without Angular2 though. Your JS is already valid TypeScript. Just include the TypeScript code into your JS code base and build them together.

share|improve this answer
    
thanks, I'll definitely try to TS code in JS. Again what if it is already created web site, and I want to use Angular 2 TS component for form validation OR site navigation etc. how feasible it is to go with Angular 2 TS? – Shree Jul 20 at 9:22
    
Not sure what you mean with "form validation". Angular form validation only works in Angular components. You can use Angular router for navigation in an Angular application but not individually outside Angular2. – Günter Zöchbauer Jul 20 at 9:24
    
"form validation" in the sense, <form> field user input field validations using Angular component. – Shree Jul 20 at 9:52

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.