Skip to content

Commit

Permalink
Updating readme for typescript.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacob Eggers committed Jan 8, 2014
1 parent 3ba295b commit 3041dd5
Showing 1 changed file with 37 additions and 4 deletions.
41 changes: 37 additions & 4 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
/// <reference path="../app.ts" />

'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

Expand Down

0 comments on commit 3041dd5

Please sign in to comment.