Running Angular and AngularJS frameworks side by side












11















I have found resources that describe how to integrate Angular (2) components into AngularJS, but all of these have involved setting up the AngularJS project like an Angular project, requiring a transpiler from TypeScript, requiring ES6, requiring import statements. I want to simply use Angular components in my AngularJS application without disrupting my existing workflow. Is this possible, and if so how do I implement it? I thought that this was the purpose of the upgrade module, but all the tutorials I have seen require import statements in the AngularJS application, which requires a transpiler. If the Angular application needs to be transpiled ahead of time, that is ok, but the AngularJS application cannot be transpiled because it is running on a django server, and I don't want to run another server with a transpiler.



To be clear, my current AngularJS application is being served by django. I want to include some Angular components. These won't be touched during development, so they can be transpiled ahead of time without affecting workflow. Is there a way of adding these components into the AngularJS app without adding a transpiler to the AngularJS app?










share|improve this question




















  • 1





    Just for clarity ... the transpiler is run on the client before being deployed to the server. So no need to set anything special up on your server.

    – DeborahK
    Apr 20 '17 at 16:24


















11















I have found resources that describe how to integrate Angular (2) components into AngularJS, but all of these have involved setting up the AngularJS project like an Angular project, requiring a transpiler from TypeScript, requiring ES6, requiring import statements. I want to simply use Angular components in my AngularJS application without disrupting my existing workflow. Is this possible, and if so how do I implement it? I thought that this was the purpose of the upgrade module, but all the tutorials I have seen require import statements in the AngularJS application, which requires a transpiler. If the Angular application needs to be transpiled ahead of time, that is ok, but the AngularJS application cannot be transpiled because it is running on a django server, and I don't want to run another server with a transpiler.



To be clear, my current AngularJS application is being served by django. I want to include some Angular components. These won't be touched during development, so they can be transpiled ahead of time without affecting workflow. Is there a way of adding these components into the AngularJS app without adding a transpiler to the AngularJS app?










share|improve this question




















  • 1





    Just for clarity ... the transpiler is run on the client before being deployed to the server. So no need to set anything special up on your server.

    – DeborahK
    Apr 20 '17 at 16:24
















11












11








11


3






I have found resources that describe how to integrate Angular (2) components into AngularJS, but all of these have involved setting up the AngularJS project like an Angular project, requiring a transpiler from TypeScript, requiring ES6, requiring import statements. I want to simply use Angular components in my AngularJS application without disrupting my existing workflow. Is this possible, and if so how do I implement it? I thought that this was the purpose of the upgrade module, but all the tutorials I have seen require import statements in the AngularJS application, which requires a transpiler. If the Angular application needs to be transpiled ahead of time, that is ok, but the AngularJS application cannot be transpiled because it is running on a django server, and I don't want to run another server with a transpiler.



To be clear, my current AngularJS application is being served by django. I want to include some Angular components. These won't be touched during development, so they can be transpiled ahead of time without affecting workflow. Is there a way of adding these components into the AngularJS app without adding a transpiler to the AngularJS app?










share|improve this question
















I have found resources that describe how to integrate Angular (2) components into AngularJS, but all of these have involved setting up the AngularJS project like an Angular project, requiring a transpiler from TypeScript, requiring ES6, requiring import statements. I want to simply use Angular components in my AngularJS application without disrupting my existing workflow. Is this possible, and if so how do I implement it? I thought that this was the purpose of the upgrade module, but all the tutorials I have seen require import statements in the AngularJS application, which requires a transpiler. If the Angular application needs to be transpiled ahead of time, that is ok, but the AngularJS application cannot be transpiled because it is running on a django server, and I don't want to run another server with a transpiler.



To be clear, my current AngularJS application is being served by django. I want to include some Angular components. These won't be touched during development, so they can be transpiled ahead of time without affecting workflow. Is there a way of adding these components into the AngularJS app without adding a transpiler to the AngularJS app?







angularjs angular ng-upgrade angular-hybrid






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jun 12 '18 at 17:38









georgeawg

33.1k104968




33.1k104968










asked Apr 20 '17 at 15:30









dz210dz210

420315




420315








  • 1





    Just for clarity ... the transpiler is run on the client before being deployed to the server. So no need to set anything special up on your server.

    – DeborahK
    Apr 20 '17 at 16:24
















  • 1





    Just for clarity ... the transpiler is run on the client before being deployed to the server. So no need to set anything special up on your server.

    – DeborahK
    Apr 20 '17 at 16:24










1




1





Just for clarity ... the transpiler is run on the client before being deployed to the server. So no need to set anything special up on your server.

– DeborahK
Apr 20 '17 at 16:24







Just for clarity ... the transpiler is run on the client before being deployed to the server. So no need to set anything special up on your server.

– DeborahK
Apr 20 '17 at 16:24














1 Answer
1






active

oldest

votes


















13














Incrementally upgrade an AngularJS application to Angular.



One of the keys to a successful upgrade is to do it incrementally, by running the two frameworks side by side in the same application, and porting AngularJS components to Angular one by one. This makes it possible to upgrade even large and complex applications without disrupting other business, because the work can be done collaboratively and spread over a period of time. The upgrade module in Angular has been designed to make incremental upgrading seamless.



For more information, see Angular 2 Guide - Upgrading from AngularJS to Angular



The DEMO on PLNKR



See also,




  • Migrating AngularJS to Angular 4,5 (with DEMO)





I don't want to run another server with a transpiler.




The transpiler can be run client-side. It is possible but not recommended.





<script src="https://unpkg.com/zone.js@0.8.4?main=browser"></script>
<script src="https://unpkg.com/systemjs@0.19.39/dist/system.src.js"></script>
<script src="systemjs.config.js"></script>
<script>
System.import('main.js').catch(function(err){ console.error(err); });
</script>


systemjs.config.js



/**
* WEB ANGULAR VERSION
* (based on systemjs.config.js in angular.io)
* System configuration for Angular samples
* Adjust as necessary for your application needs.
*/
(function (global) {
System.config({
// DEMO ONLY! REAL CODE SHOULD NOT TRANSPILE IN THE BROWSER
transpiler: 'ts',
typescriptOptions: {
// Copy of compiler options in standard tsconfig.json
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": ["es2015", "dom"],
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true
},
meta: {
'typescript': {
"exports": "ts"
}
},
paths: {
// paths serve as alias
'npm:': 'https://unpkg.com/'
},
// map tells the System loader where to look for things
map: {
// our app is within the app folder
'app': 'app',

// angular bundles
'@angular/animations': 'npm:@angular/animations/bundles/animations.umd.js',
'@angular/animations/browser': 'npm:@angular/animations/bundles/animations-browser.umd.js',
'@angular/core': 'npm:@angular/core/bundles/core.umd.js',
'@angular/common': 'npm:@angular/common/bundles/common.umd.js',
'@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
'@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
'@angular/platform-browser/animations': 'npm:@angular/platform-browser/bundles/platform-browser-animations.umd.js',
'@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
'@angular/http': 'npm:@angular/http/bundles/http.umd.js',
'@angular/router': 'npm:@angular/router/bundles/router.umd.js',
'@angular/router/upgrade': 'npm:@angular/router/bundles/router-upgrade.umd.js',
'@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
'@angular/upgrade': 'npm:@angular/upgrade/bundles/upgrade.umd.js',
'@angular/upgrade/static': 'npm:@angular/upgrade/bundles/upgrade-static.umd.js',

// other libraries
'rxjs': 'npm:rxjs@5.0.1',
'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js',
'ts': 'npm:plugin-typescript@5.2.7/lib/plugin.js',
'typescript': 'npm:typescript@2.2.1/lib/typescript.js',

},
// packages tells the System loader how to load when no filename and/or no extension
packages: {
app: {
main: './main.ts',
defaultExtension: 'ts',
meta: {
'./*.ts': {
loader: 'systemjs-angular-loader.js'
}
}
},
rxjs: {
defaultExtension: 'js'
}
}
});

})(this);


For more information, see Angular 2 TypeScript QuickStart





Convert Angular TypeScript examples into ES6 and ES5 JavaScript.



Anything you can do with Angular in TypeScript, you can also do in JavaScript. Translating from one language to the other is mostly a matter of changing the way you organize your code and access Angular APIs.



For more information, see Angular 2 Developer Cookbook - TypeScript to JavaScript






share|improve this answer





















  • 1





    This is neat but I haven't been able to get this to work locally. It seems set up specifically for the example, and not recommended for a real application. Then, it seems that what I'm asking is not possible. Perhaps my question was not clear: I want to transpile the Angular 2 components ahead of time, then use them as AngularJS directives in my AngularJS app, without including the Angular 2 imports like webpack and transpilers. I'll update my question.

    – dz210
    Apr 20 '17 at 18:23











  • Added additonal info on TS to JS.

    – georgeawg
    Apr 20 '17 at 19:32






  • 1





    Thanks but the code has already been written in TS. I guess the answer is no :(

    – dz210
    Apr 20 '17 at 21:50











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f43523907%2frunning-angular-and-angularjs-frameworks-side-by-side%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









13














Incrementally upgrade an AngularJS application to Angular.



One of the keys to a successful upgrade is to do it incrementally, by running the two frameworks side by side in the same application, and porting AngularJS components to Angular one by one. This makes it possible to upgrade even large and complex applications without disrupting other business, because the work can be done collaboratively and spread over a period of time. The upgrade module in Angular has been designed to make incremental upgrading seamless.



For more information, see Angular 2 Guide - Upgrading from AngularJS to Angular



The DEMO on PLNKR



See also,




  • Migrating AngularJS to Angular 4,5 (with DEMO)





I don't want to run another server with a transpiler.




The transpiler can be run client-side. It is possible but not recommended.





<script src="https://unpkg.com/zone.js@0.8.4?main=browser"></script>
<script src="https://unpkg.com/systemjs@0.19.39/dist/system.src.js"></script>
<script src="systemjs.config.js"></script>
<script>
System.import('main.js').catch(function(err){ console.error(err); });
</script>


systemjs.config.js



/**
* WEB ANGULAR VERSION
* (based on systemjs.config.js in angular.io)
* System configuration for Angular samples
* Adjust as necessary for your application needs.
*/
(function (global) {
System.config({
// DEMO ONLY! REAL CODE SHOULD NOT TRANSPILE IN THE BROWSER
transpiler: 'ts',
typescriptOptions: {
// Copy of compiler options in standard tsconfig.json
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": ["es2015", "dom"],
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true
},
meta: {
'typescript': {
"exports": "ts"
}
},
paths: {
// paths serve as alias
'npm:': 'https://unpkg.com/'
},
// map tells the System loader where to look for things
map: {
// our app is within the app folder
'app': 'app',

// angular bundles
'@angular/animations': 'npm:@angular/animations/bundles/animations.umd.js',
'@angular/animations/browser': 'npm:@angular/animations/bundles/animations-browser.umd.js',
'@angular/core': 'npm:@angular/core/bundles/core.umd.js',
'@angular/common': 'npm:@angular/common/bundles/common.umd.js',
'@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
'@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
'@angular/platform-browser/animations': 'npm:@angular/platform-browser/bundles/platform-browser-animations.umd.js',
'@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
'@angular/http': 'npm:@angular/http/bundles/http.umd.js',
'@angular/router': 'npm:@angular/router/bundles/router.umd.js',
'@angular/router/upgrade': 'npm:@angular/router/bundles/router-upgrade.umd.js',
'@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
'@angular/upgrade': 'npm:@angular/upgrade/bundles/upgrade.umd.js',
'@angular/upgrade/static': 'npm:@angular/upgrade/bundles/upgrade-static.umd.js',

// other libraries
'rxjs': 'npm:rxjs@5.0.1',
'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js',
'ts': 'npm:plugin-typescript@5.2.7/lib/plugin.js',
'typescript': 'npm:typescript@2.2.1/lib/typescript.js',

},
// packages tells the System loader how to load when no filename and/or no extension
packages: {
app: {
main: './main.ts',
defaultExtension: 'ts',
meta: {
'./*.ts': {
loader: 'systemjs-angular-loader.js'
}
}
},
rxjs: {
defaultExtension: 'js'
}
}
});

})(this);


For more information, see Angular 2 TypeScript QuickStart





Convert Angular TypeScript examples into ES6 and ES5 JavaScript.



Anything you can do with Angular in TypeScript, you can also do in JavaScript. Translating from one language to the other is mostly a matter of changing the way you organize your code and access Angular APIs.



For more information, see Angular 2 Developer Cookbook - TypeScript to JavaScript






share|improve this answer





















  • 1





    This is neat but I haven't been able to get this to work locally. It seems set up specifically for the example, and not recommended for a real application. Then, it seems that what I'm asking is not possible. Perhaps my question was not clear: I want to transpile the Angular 2 components ahead of time, then use them as AngularJS directives in my AngularJS app, without including the Angular 2 imports like webpack and transpilers. I'll update my question.

    – dz210
    Apr 20 '17 at 18:23











  • Added additonal info on TS to JS.

    – georgeawg
    Apr 20 '17 at 19:32






  • 1





    Thanks but the code has already been written in TS. I guess the answer is no :(

    – dz210
    Apr 20 '17 at 21:50
















13














Incrementally upgrade an AngularJS application to Angular.



One of the keys to a successful upgrade is to do it incrementally, by running the two frameworks side by side in the same application, and porting AngularJS components to Angular one by one. This makes it possible to upgrade even large and complex applications without disrupting other business, because the work can be done collaboratively and spread over a period of time. The upgrade module in Angular has been designed to make incremental upgrading seamless.



For more information, see Angular 2 Guide - Upgrading from AngularJS to Angular



The DEMO on PLNKR



See also,




  • Migrating AngularJS to Angular 4,5 (with DEMO)





I don't want to run another server with a transpiler.




The transpiler can be run client-side. It is possible but not recommended.





<script src="https://unpkg.com/zone.js@0.8.4?main=browser"></script>
<script src="https://unpkg.com/systemjs@0.19.39/dist/system.src.js"></script>
<script src="systemjs.config.js"></script>
<script>
System.import('main.js').catch(function(err){ console.error(err); });
</script>


systemjs.config.js



/**
* WEB ANGULAR VERSION
* (based on systemjs.config.js in angular.io)
* System configuration for Angular samples
* Adjust as necessary for your application needs.
*/
(function (global) {
System.config({
// DEMO ONLY! REAL CODE SHOULD NOT TRANSPILE IN THE BROWSER
transpiler: 'ts',
typescriptOptions: {
// Copy of compiler options in standard tsconfig.json
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": ["es2015", "dom"],
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true
},
meta: {
'typescript': {
"exports": "ts"
}
},
paths: {
// paths serve as alias
'npm:': 'https://unpkg.com/'
},
// map tells the System loader where to look for things
map: {
// our app is within the app folder
'app': 'app',

// angular bundles
'@angular/animations': 'npm:@angular/animations/bundles/animations.umd.js',
'@angular/animations/browser': 'npm:@angular/animations/bundles/animations-browser.umd.js',
'@angular/core': 'npm:@angular/core/bundles/core.umd.js',
'@angular/common': 'npm:@angular/common/bundles/common.umd.js',
'@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
'@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
'@angular/platform-browser/animations': 'npm:@angular/platform-browser/bundles/platform-browser-animations.umd.js',
'@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
'@angular/http': 'npm:@angular/http/bundles/http.umd.js',
'@angular/router': 'npm:@angular/router/bundles/router.umd.js',
'@angular/router/upgrade': 'npm:@angular/router/bundles/router-upgrade.umd.js',
'@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
'@angular/upgrade': 'npm:@angular/upgrade/bundles/upgrade.umd.js',
'@angular/upgrade/static': 'npm:@angular/upgrade/bundles/upgrade-static.umd.js',

// other libraries
'rxjs': 'npm:rxjs@5.0.1',
'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js',
'ts': 'npm:plugin-typescript@5.2.7/lib/plugin.js',
'typescript': 'npm:typescript@2.2.1/lib/typescript.js',

},
// packages tells the System loader how to load when no filename and/or no extension
packages: {
app: {
main: './main.ts',
defaultExtension: 'ts',
meta: {
'./*.ts': {
loader: 'systemjs-angular-loader.js'
}
}
},
rxjs: {
defaultExtension: 'js'
}
}
});

})(this);


For more information, see Angular 2 TypeScript QuickStart





Convert Angular TypeScript examples into ES6 and ES5 JavaScript.



Anything you can do with Angular in TypeScript, you can also do in JavaScript. Translating from one language to the other is mostly a matter of changing the way you organize your code and access Angular APIs.



For more information, see Angular 2 Developer Cookbook - TypeScript to JavaScript






share|improve this answer





















  • 1





    This is neat but I haven't been able to get this to work locally. It seems set up specifically for the example, and not recommended for a real application. Then, it seems that what I'm asking is not possible. Perhaps my question was not clear: I want to transpile the Angular 2 components ahead of time, then use them as AngularJS directives in my AngularJS app, without including the Angular 2 imports like webpack and transpilers. I'll update my question.

    – dz210
    Apr 20 '17 at 18:23











  • Added additonal info on TS to JS.

    – georgeawg
    Apr 20 '17 at 19:32






  • 1





    Thanks but the code has already been written in TS. I guess the answer is no :(

    – dz210
    Apr 20 '17 at 21:50














13












13








13







Incrementally upgrade an AngularJS application to Angular.



One of the keys to a successful upgrade is to do it incrementally, by running the two frameworks side by side in the same application, and porting AngularJS components to Angular one by one. This makes it possible to upgrade even large and complex applications without disrupting other business, because the work can be done collaboratively and spread over a period of time. The upgrade module in Angular has been designed to make incremental upgrading seamless.



For more information, see Angular 2 Guide - Upgrading from AngularJS to Angular



The DEMO on PLNKR



See also,




  • Migrating AngularJS to Angular 4,5 (with DEMO)





I don't want to run another server with a transpiler.




The transpiler can be run client-side. It is possible but not recommended.





<script src="https://unpkg.com/zone.js@0.8.4?main=browser"></script>
<script src="https://unpkg.com/systemjs@0.19.39/dist/system.src.js"></script>
<script src="systemjs.config.js"></script>
<script>
System.import('main.js').catch(function(err){ console.error(err); });
</script>


systemjs.config.js



/**
* WEB ANGULAR VERSION
* (based on systemjs.config.js in angular.io)
* System configuration for Angular samples
* Adjust as necessary for your application needs.
*/
(function (global) {
System.config({
// DEMO ONLY! REAL CODE SHOULD NOT TRANSPILE IN THE BROWSER
transpiler: 'ts',
typescriptOptions: {
// Copy of compiler options in standard tsconfig.json
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": ["es2015", "dom"],
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true
},
meta: {
'typescript': {
"exports": "ts"
}
},
paths: {
// paths serve as alias
'npm:': 'https://unpkg.com/'
},
// map tells the System loader where to look for things
map: {
// our app is within the app folder
'app': 'app',

// angular bundles
'@angular/animations': 'npm:@angular/animations/bundles/animations.umd.js',
'@angular/animations/browser': 'npm:@angular/animations/bundles/animations-browser.umd.js',
'@angular/core': 'npm:@angular/core/bundles/core.umd.js',
'@angular/common': 'npm:@angular/common/bundles/common.umd.js',
'@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
'@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
'@angular/platform-browser/animations': 'npm:@angular/platform-browser/bundles/platform-browser-animations.umd.js',
'@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
'@angular/http': 'npm:@angular/http/bundles/http.umd.js',
'@angular/router': 'npm:@angular/router/bundles/router.umd.js',
'@angular/router/upgrade': 'npm:@angular/router/bundles/router-upgrade.umd.js',
'@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
'@angular/upgrade': 'npm:@angular/upgrade/bundles/upgrade.umd.js',
'@angular/upgrade/static': 'npm:@angular/upgrade/bundles/upgrade-static.umd.js',

// other libraries
'rxjs': 'npm:rxjs@5.0.1',
'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js',
'ts': 'npm:plugin-typescript@5.2.7/lib/plugin.js',
'typescript': 'npm:typescript@2.2.1/lib/typescript.js',

},
// packages tells the System loader how to load when no filename and/or no extension
packages: {
app: {
main: './main.ts',
defaultExtension: 'ts',
meta: {
'./*.ts': {
loader: 'systemjs-angular-loader.js'
}
}
},
rxjs: {
defaultExtension: 'js'
}
}
});

})(this);


For more information, see Angular 2 TypeScript QuickStart





Convert Angular TypeScript examples into ES6 and ES5 JavaScript.



Anything you can do with Angular in TypeScript, you can also do in JavaScript. Translating from one language to the other is mostly a matter of changing the way you organize your code and access Angular APIs.



For more information, see Angular 2 Developer Cookbook - TypeScript to JavaScript






share|improve this answer















Incrementally upgrade an AngularJS application to Angular.



One of the keys to a successful upgrade is to do it incrementally, by running the two frameworks side by side in the same application, and porting AngularJS components to Angular one by one. This makes it possible to upgrade even large and complex applications without disrupting other business, because the work can be done collaboratively and spread over a period of time. The upgrade module in Angular has been designed to make incremental upgrading seamless.



For more information, see Angular 2 Guide - Upgrading from AngularJS to Angular



The DEMO on PLNKR



See also,




  • Migrating AngularJS to Angular 4,5 (with DEMO)





I don't want to run another server with a transpiler.




The transpiler can be run client-side. It is possible but not recommended.





<script src="https://unpkg.com/zone.js@0.8.4?main=browser"></script>
<script src="https://unpkg.com/systemjs@0.19.39/dist/system.src.js"></script>
<script src="systemjs.config.js"></script>
<script>
System.import('main.js').catch(function(err){ console.error(err); });
</script>


systemjs.config.js



/**
* WEB ANGULAR VERSION
* (based on systemjs.config.js in angular.io)
* System configuration for Angular samples
* Adjust as necessary for your application needs.
*/
(function (global) {
System.config({
// DEMO ONLY! REAL CODE SHOULD NOT TRANSPILE IN THE BROWSER
transpiler: 'ts',
typescriptOptions: {
// Copy of compiler options in standard tsconfig.json
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": ["es2015", "dom"],
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true
},
meta: {
'typescript': {
"exports": "ts"
}
},
paths: {
// paths serve as alias
'npm:': 'https://unpkg.com/'
},
// map tells the System loader where to look for things
map: {
// our app is within the app folder
'app': 'app',

// angular bundles
'@angular/animations': 'npm:@angular/animations/bundles/animations.umd.js',
'@angular/animations/browser': 'npm:@angular/animations/bundles/animations-browser.umd.js',
'@angular/core': 'npm:@angular/core/bundles/core.umd.js',
'@angular/common': 'npm:@angular/common/bundles/common.umd.js',
'@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
'@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
'@angular/platform-browser/animations': 'npm:@angular/platform-browser/bundles/platform-browser-animations.umd.js',
'@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
'@angular/http': 'npm:@angular/http/bundles/http.umd.js',
'@angular/router': 'npm:@angular/router/bundles/router.umd.js',
'@angular/router/upgrade': 'npm:@angular/router/bundles/router-upgrade.umd.js',
'@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
'@angular/upgrade': 'npm:@angular/upgrade/bundles/upgrade.umd.js',
'@angular/upgrade/static': 'npm:@angular/upgrade/bundles/upgrade-static.umd.js',

// other libraries
'rxjs': 'npm:rxjs@5.0.1',
'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js',
'ts': 'npm:plugin-typescript@5.2.7/lib/plugin.js',
'typescript': 'npm:typescript@2.2.1/lib/typescript.js',

},
// packages tells the System loader how to load when no filename and/or no extension
packages: {
app: {
main: './main.ts',
defaultExtension: 'ts',
meta: {
'./*.ts': {
loader: 'systemjs-angular-loader.js'
}
}
},
rxjs: {
defaultExtension: 'js'
}
}
});

})(this);


For more information, see Angular 2 TypeScript QuickStart





Convert Angular TypeScript examples into ES6 and ES5 JavaScript.



Anything you can do with Angular in TypeScript, you can also do in JavaScript. Translating from one language to the other is mostly a matter of changing the way you organize your code and access Angular APIs.



For more information, see Angular 2 Developer Cookbook - TypeScript to JavaScript







share|improve this answer














share|improve this answer



share|improve this answer








edited Aug 12 '18 at 5:40

























answered Apr 20 '17 at 17:07









georgeawggeorgeawg

33.1k104968




33.1k104968








  • 1





    This is neat but I haven't been able to get this to work locally. It seems set up specifically for the example, and not recommended for a real application. Then, it seems that what I'm asking is not possible. Perhaps my question was not clear: I want to transpile the Angular 2 components ahead of time, then use them as AngularJS directives in my AngularJS app, without including the Angular 2 imports like webpack and transpilers. I'll update my question.

    – dz210
    Apr 20 '17 at 18:23











  • Added additonal info on TS to JS.

    – georgeawg
    Apr 20 '17 at 19:32






  • 1





    Thanks but the code has already been written in TS. I guess the answer is no :(

    – dz210
    Apr 20 '17 at 21:50














  • 1





    This is neat but I haven't been able to get this to work locally. It seems set up specifically for the example, and not recommended for a real application. Then, it seems that what I'm asking is not possible. Perhaps my question was not clear: I want to transpile the Angular 2 components ahead of time, then use them as AngularJS directives in my AngularJS app, without including the Angular 2 imports like webpack and transpilers. I'll update my question.

    – dz210
    Apr 20 '17 at 18:23











  • Added additonal info on TS to JS.

    – georgeawg
    Apr 20 '17 at 19:32






  • 1





    Thanks but the code has already been written in TS. I guess the answer is no :(

    – dz210
    Apr 20 '17 at 21:50








1




1





This is neat but I haven't been able to get this to work locally. It seems set up specifically for the example, and not recommended for a real application. Then, it seems that what I'm asking is not possible. Perhaps my question was not clear: I want to transpile the Angular 2 components ahead of time, then use them as AngularJS directives in my AngularJS app, without including the Angular 2 imports like webpack and transpilers. I'll update my question.

– dz210
Apr 20 '17 at 18:23





This is neat but I haven't been able to get this to work locally. It seems set up specifically for the example, and not recommended for a real application. Then, it seems that what I'm asking is not possible. Perhaps my question was not clear: I want to transpile the Angular 2 components ahead of time, then use them as AngularJS directives in my AngularJS app, without including the Angular 2 imports like webpack and transpilers. I'll update my question.

– dz210
Apr 20 '17 at 18:23













Added additonal info on TS to JS.

– georgeawg
Apr 20 '17 at 19:32





Added additonal info on TS to JS.

– georgeawg
Apr 20 '17 at 19:32




1




1





Thanks but the code has already been written in TS. I guess the answer is no :(

– dz210
Apr 20 '17 at 21:50





Thanks but the code has already been written in TS. I guess the answer is no :(

– dz210
Apr 20 '17 at 21:50


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f43523907%2frunning-angular-and-angularjs-frameworks-side-by-side%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Monofisismo

Angular Downloading a file using contenturl with Basic Authentication

Olmecas