Giter Club home page Giter Club logo

ng-metadata-quickstart's Introduction

#ngMetadata Quickstart Sample project to quickstart an Angular 1.x application with Typescript using ngMetadata to be ready to easly migrate to NG2 when it'll be ready!

##Prerequisite Prerequisite that you need to install before starting project

  • Download and install node >4.x
  • Globally install Typescript , typings
npm i -g  typescript  
npm i -g  typings
  • Optionally install npm i -g http-server to serve page locally

##Installation and Run Clone this repo and then simply install the dependency and run it:

npm install
npm start

Open your browser and go to http://localhost:8080

###Initial setup (JUST DONE) This step was JUST DONE to produce the repository in the current state, so you don't need to redone it! But it may be useful to know how to start from scratch.

npm init -y
npm i --save  angular  reflect-metadata  systemjs  ng-metadata
npm i --save-dev  typescript  tslint
npm i -g typings
typings init
typings install  jquery  angular  --save  --ambient

####Folder structure

\ - app                             <-- contains all your Typescript code
|    \ - components     
|    |    \ - my-app.component.ts   <-- sample component
|    | - app.module.ts              <-- define app module
|    \ - startup.ts                 <-- entry point boostrap angular app
|
| - dist                            <-- output directory for transpiled code TS->JS
| - index.html                      <-- initial page that load ambient dependency: SystemJS, Reflect-metadata 
| - system.conf.js                  <-- SystemJS configuration for loading module starting from 'app/startup' entrypoint 
\ - tsconfig.json                   <-- configure compiler (tsc) to build Typescript code 

Configure tsconfig.json to build Typescipt app files and output js to dist folder, and setup SystemJS into systemjs.conf.js to load the Angular app module bootstrapping it with ngMetadata from app/startup . And finally setup some scripts in package.json to automate build and serve

###OTHER SETUP AND SAMPLE This repo contains other SystemJS config and TS sample, to test different setup checkout branches:

  • browserify sample with TS compiled using Browserify + Tsify to build single bundle from commonjs/node modules
  • bundle sample with TS compiler set with outFile to produce dist/app-bundle.js using system
  • outdir sample with TS compiler set with outDir to produce all js in dist folder using commonjs
  • plugins sample using SystemJS plugins to load external component html and include css styles
  • test sample showing how to configure test with karma (contrib by Michael de Lang @Oipo)

ng-metadata-quickstart's People

Contributors

dmorosinotto avatar

Stargazers

David Hollifield avatar Joshua Wiens avatar Viliam Elischer avatar Martin Hochel avatar

Watchers

James Cloos avatar  avatar

Forkers

oipo

ng-metadata-quickstart's Issues

load templates via systemJS plugin-text

using templateUrl for loading templates in ng1 introduces a lot of problems / testing/no guarantees about children template resolution.

It would awesome if you can provide loading templates via systemJS

import tpl from './my-component.html!text';

// ...
@Component{(
// ...
 template: tpl
// ...
)}
class MyComponent{}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.