include ../../../../_includes/_util-fns :marked Everything that we can do in Angular 2 in TypeScript, we can also do in JavaScript. Translating from one language to the other is mostly a matter of changing the way we organize our code and the way we access Angular 2 APIs. Since TypeScript is a popular language option in Angular 2, many of the code examples you see on the Internet as well as on this site are written in TypeScript. This cookbook contains recipes for translating these kinds of code examples to ES5, so that they can be applied to Angular 2 JavaScript applications. :marked ## Table of contents [Modularity: imports and exports](#modularity) [Classes and Class Metadata](#class-metadata) [Input and Output Metadata](#property-metadata) [Dependency Injection](#dependency-injection) [Host and Query Metadata](#other-property-metadata) **Run and compare the live [TypeScript](/resources/live-examples/cb-ts-to-js/ts/plnkr.html) and [JavaScript](/resources/live-examples/cb-ts-to-js/js/plnkr.html) code shown in this cookbook.** a(id="modularity") .l-main-section :marked ## Importing and Exporting - var top="vertical-align:top" table(width="100%") col(width="50%") col(width="50%") tr th TypeScript th ES5 JavaScript tr(style=top) td :marked ### Importing Angular 2 Code In TypeScript code, Angular 2 classes, functions, and other members are imported with TypeScript `import` statements: +makeExample('cb-ts-to-js/ts/app/main.ts', 'ng2import')(format="." ) td :marked ### Accessing Angular 2 Code through the ng global In JavaScript code, when using [the Angular 2 packages](../glossary.html#!#scoped-package), we can access Angular code through the global `ng` object. In the nested members of this object we'll find everything we would import from `angular2` in TypeScript: +makeExample('cb-ts-to-js/js/app/main.js', 'ng2import')(format="." ) tr(style=top) td :marked ### Importing and Exporting Application Code Each file in an Angular 2 TypeScript application constitutes a TypeScript module. When we want to make something from a module available to other modules, we `export` it. +makeExample('cb-ts-to-js/ts/app/hero.component.ts', 'appexport')(format="." ) :marked In other modules we can then `import` things that have been exported elsewhere. +makeExample('cb-ts-to-js/ts/app/main.ts', 'appimport')(format="." ) td :marked ### Sharing Application Code In an Angular 2 JavaScript application, we load each file to the page using a `