Skip to content

tamascsaba/ng2-experience

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 

Repository files navigation

ng2-experience

WIP

It is a little description of my one year Angular2 experience.

My first project was POC which is written by AtScript. It uses alpha-19 verison of angular2

Other really good style guide by mgechev.

Community

Angular community is really great. They are very responsive on github issues and gitter too.

Examples

Look after my stars search for angular2 or ng2. I liked every good angular2 repository. awesome-angular2 and angular2-education are good base of knowledge.

Naming conversion

Say everything the right way. eg:

Components:
    AppComponent
    NotificationComponent
    ...
Services:
    ApiService
    NotificationService
...

Directory and file structure

├── components
│   ├── app
│   │   ├── app.html
│   │   ├── app.scss
│   │   └── AppComponent.ts
│   └── notification
│       ├── notification.html
│       ├── notification.scss
│       └── NotificationComponent.ts
├── directives
├── interfaces
├── layouts
├── pages
│   ├── dashboard
│   │   ├── dashboard.html
│   │   └── DashboardPage.ts
│   └── login
│       ├── login.html
│       ├── login.scss
│       ├── LoginPage.ts
│       ├── LoginService.ts
│       └── tests
│           ├── LoginPageTest.ts
│           └── LoginServiceTest.ts
├── services
├── style
└── bootstrap.ts

Templates and styles are shorten, because extension is well defined (templates and styles).

Only global services go to services folder.

Keep tests close to to source code.

Server side

I don't suggest using ts-node and every node module which hacks require.extension. Use ```browserify --node`` or webpack with right config to generate server side build.

Build (bundle)

I use browserify (persistify, watchify, errorify, tsify, sassportify) but webpack is also great. I think Rollup can make smaller code, but it doesn't have watch option yet.

IDE/Editor

I use Sublime and official Microsoft plugin but I think atom and vscode is also ideal for development, but much slower than sublime. When you prefer complex IDE use webstorm.

Lint

I suggest using tslint, I think it's the best when using typescript.

Documentation

I use typedoc to generate documentation, but templating is a little bit difficult i think.

Test

I think karma has too complicated architecture. I suggest you using only jasmine or mocha, because the full source code is universal and runnable with nodejs. Always write universal code. Never run tests on ts files, compile first, ts-node is really slow the newest too. My tests run with ts-node 10s long and with compiles js only 1s.

TypeScript vs ES6

I use typescript in angular2 based code, which usually use rxjs too (it is also written by typescript). When you write codes which most often depend on node modules eg: express, node libs and middlewares use ES6, while lot of package don't have typing definition (d.ts).

Typescript compiler (tsc) compile the fastest code, but sometimes not the standard way.

About

My Angular2 experience

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published