From 3041dd55d6bce9e67e71f58089faab4f247156b1 Mon Sep 17 00:00:00 2001 From: Jacob Eggers Date: Tue, 7 Jan 2014 17:27:41 -0800 Subject: [PATCH] Updating readme for typescript. --- readme.md | 41 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/readme.md b/readme.md index 8cf58f6c5..3310e1290 100644 --- a/readme.md +++ b/readme.md @@ -173,8 +173,8 @@ angular.module('myMod').config(function ($provide) { ## Options In general, these options can be applied to any generator, though they only affect generators that produce scripts. -### CoffeeScript -For generators that output scripts, the `--coffee` option will output CoffeeScript instead of JavaScript. +### CoffeeScript and TypeScript +For generators that output scripts, the `--coffee` option will output CoffeeScript instead of JavaScript, and `--typescript` will out put TypeScript instead of JavaScript. For example: ```bash @@ -187,9 +187,42 @@ angular.module('myMod') .controller 'UserCtrl', ($scope) -> ``` -A project can mix CoffeScript and JavaScript files. +For example: +```bash +yo angular:controller user --typescript +``` + +Produces `app/scripts/controller/user.ts`: +```typescript +/// + +'use strict'; + +module demoApp { + export interface IUserScope extends ng.IScope { + awesomeThings: any[]; + } + + export class UserCtrl { + + constructor (private $scope:IUserScope) { + $scope.awesomeThings = [ + 'HTML5 Boilerplate', + 'AngularJS', + 'Karma' + ]; + } + } +} + +angular.module('demoApp') + .controller('UserCtrl', demoApp.UserCtrl); +``` + + +A project can mix TypeScript, CoffeScript, and JavaScript files. -To output JavaScript files, even if CoffeeScript files exist (the default is to output CoffeeScript files if the generator finds any in the project), use `--coffee=false`. +To output JavaScript files, even if CoffeeScript (or TypeScript) files exist (the default is to output CoffeeScript files if the generator finds any in the project), use `--coffee=false` and/or `--typescript=false`. ### Minification Safe