These are chat archives for AngularClass/angular2-webpack-starter

24th
Nov 2015
Matthew de Nobrega
@matthewdenobrega
Nov 24 2015 12:48

@bradcliffe for me the easiest way to manage loading data from an api is to have the AccountService return an observable, and assign the value the Observable resolves to in the controller.

accountService.loadAccount().subscribe(res => this.account = res);
`

So the services make Observables of data available, and other components can subscribe to those Observables and do whatever they need to with the data coming from them. I know a lot of people liked the way you could assign a promise to a variable in Angular.js and it would take the value and update the DOM when the promise resolved, but that sort of 'looks like synchronous code but isn't' hides a lot of complexity - having services expose Observables of data is more flexible (you can do all the RXjs magic on the streams) and easier to reason about, at the cost of a bit of a learning curve.

Has anyone here used immutable data with Typescript? Immutable.js is fine for untyped data (arrays, hashmaps), but I can't see a way to declare typed immutable objects in Typescript. My understanding is the const keyword blocks updating an Object reference, but doesn't block updating the values of members. Seems a pity to have to decide between immutability and typing, so if anyone has a working approach to share that would be great.
binarious
@binarious
Nov 24 2015 14:32

How do I need to include 3rd party angular2 modules written in TypeScript? I tried it with ng2-bootstrap the following way:

import {pagination} from 'ng2-bootstrap/ng2-bootstrap';

This results in:

Module parse failed: /Users/xxx/projects/xxx/node_modules/ng2-bootstrap/ng2-bootstrap.ts Line 1: Unexpected token
You may need an appropriate loader to handle this file type.
| export * from  './components/accordion/accordion';
| export * from  './components/alert/alert';
| export * from  './components/buttons/button-radio';
 @ ./src/components/delivery/list.ts 26:22-60
PatrickJS [tipe.io]
@gdi2290
Nov 24 2015 15:02
@binarious can you check out this Pull-Request
https://github.com/AngularClass/angular2-webpack-starter/pull/127/files
binarious
@binarious
Nov 24 2015 15:02
@gdi2290 Thank you!
PatrickJS [tipe.io]
@gdi2290
Nov 24 2015 15:03
np, for faster replies you can join our slack
http://angularclass.com/member-join/
binarious
@binarious
Nov 24 2015 15:17
Joined via that form. Do you have some complex ng2 form examples at Angular Class?
PatrickJS [tipe.io]
@gdi2290
Nov 24 2015 15:18
@binarious we don’t but we take requests so I can make one. just send me a gist with requirements for the example you want to see
binarious
@binarious
Nov 24 2015 15:19
@gdi2290 I'll talk to my team to gather the requirements tomorrow. What's the pricing?
PatrickJS [tipe.io]
@gdi2290
Nov 24 2015 15:20
depending on the requirements it’s free since we would write a blog post about it
binarious
@binarious
Nov 24 2015 15:21
allright, thanks for the input.
PatrickJS [tipe.io]
@gdi2290
Nov 24 2015 15:21
np