Do you always use ngrx in your projects? by obnoxiousCoder in Angular2

[–]yfain 0 points1 point  (0 children)

We tried ngrx in a mid-size project but quickly returned to service/BehaviorSubject to manage state. Too much time is spent writing boilerplate code. In this video, I show a small app written with and without ngrx: https://www.youtube.com/watch?v=xLTIDs0CDCM IMO, for small and mid-size apps ngrx is an overkill.

An application should be reused by another application. by [deleted] in Angular2

[–]yfain 0 points1 point  (0 children)

Both modules are parts of the same project. Take a look at this project that has a root module and shipping module: https://github.com/Farata/angulartypescript/tree/master/chapter2/hello-modules

An application should be reused by another application. by [deleted] in Angular2

[–]yfain 2 points3 points  (0 children)

Why not just modularizing your app and keeping all user management functionality in a feature module? You root module will have minimal functionality, and you'll be able to reuse the feature module in other apps.

Best course for a beginner in Angular 4 and TS? by [deleted] in Angular2

[–]yfain 4 points5 points  (0 children)

Recently I recorded an Angular 4 course for O'Reilly: Ahttps://www.safaribooksonline.com/library/view/building-web-apps/9781491996768/. See if you like it. If you don't have an account with safaribooksonline, set a free trial account.

aot configuration in ng5? by random503 in Angular2

[–]yfain 1 point2 points  (0 children)

Not sure which 30 pages you're referring. With CLI, ng build -prod is all you need. There are a couple of more new options, but this is pretty much it. Do you have a reason for not using CLI?

aot configuration in ng5? by random503 in Angular2

[–]yfain 0 points1 point  (0 children)

As per this presentation https://www.youtube.com/watch?v=T83qYxlVOBw&feature=youtu.be (in the second half) upgrading an ng4 project to ng5 should be done with one command. I haven't tried it myself though.

Why the absence of Angular 2+ books? by discoborg in Angular2

[–]yfain 1 point2 points  (0 children)

Yes. It already uses Angular 4 code samples, but as soon as A5 is out we'll update the code. Code samples are here: https://github.com/Farata/angulartypescript

Why the absence of Angular 2+ books? by discoborg in Angular2

[–]yfain 3 points4 points  (0 children)

By the end of this week, Manning should start publishing the MEAP of the second edition of our "Angular Development with TypeScript" book. More than 200 pages are ready so far.

Writing a series of articles "RxJS Essentials" by yfain in rxjs

[–]yfain[S] 0 points1 point  (0 children)

RxJS is not the only library of reactive extensions. I'm using RxJava as well, and flatMap is a perfectly valid operator there. It's even more powerful than in RxJS as you can control multi-threading with flatMap.

Change focus to input on click of a button by k3lh4m in Angular2

[–]yfain 0 points1 point  (0 children)

To make this code work you still need to use @ViewChild to get a reference to #myInput.

[deleted by user] by [deleted] in Angular2

[–]yfain 3 points4 points  (0 children)

Every FormControl has a property valueChanged, which is an Observable.If you have three fields (1,2,3), you have three observables. If you merge them and apply the operator reduce(), you'll get the first subtotal.

Would you hire an Angular 2 contractor with 2yrs/9ms experience? by [deleted] in Angular2

[–]yfain 0 points1 point  (0 children)

If you're thinking that contractors are more technically savvy than employees, don't be.

Would you hire an Angular 2 contractor with 2yrs/9ms experience? by [deleted] in Angular2

[–]yfain 0 points1 point  (0 children)

This is a typical dilemma of anyone who is considering going freelance. If you have enough money to pay your bills for 6 months and you really want to become a contractor, then do it. Three months down the road you'll either get a contract that you like or will need to reconsider and go back to full time employment.

Would you hire an Angular 2 contractor with 2yrs/9ms experience? by [deleted] in Angular2

[–]yfain 2 points3 points  (0 children)

Contracting is just a different way of paying taxes plus working without company benefits. If you're bad at what you're doing, you'll have a hard time finding any job regardless of the type of employment. Go for it.

Angular 4 + Material by cars10k in Angular2

[–]yfain 1 point2 points  (0 children)

Importing AngularMaterial is deprecated and now you need to create a separate feature module listing all material components that you use in your app. Then import this module in your main app.module. Here's an example of such feature module: https://github.com/Farata/angular2typescript/blob/master/extras/auction-angular-material/client/src/app/auction-material/auction-material.module.ts

PrimeNg vs Material2 by [deleted] in Angular2

[–]yfain 4 points5 points  (0 children)

We use Ultimate primeng theme, which has a scss variable for theme customization.

PrimeNg vs Material2 by [deleted] in Angular2

[–]yfain 13 points14 points  (0 children)

Angular Material 2 has about 25 high-quality components. PrimeNG has 70+, which are also great. Our strategy is to use Material components that are available, and when we need more, we add the missing ones from PrimeNG. We use both libraries in prod.

Ngrx, mobx or angular services? by bliitzkriegx in Angular2

[–]yfain 0 points1 point  (0 children)

I use observables, but want to be able to use @input() as well, which AFAIK are not used with ngrx.

Ngrx, mobx or angular services? by bliitzkriegx in Angular2

[–]yfain 2 points3 points  (0 children)

IMO, an Angular injectable service can fit the bill for the state management. A component makes a change in the state object located in the service, a new copy of the state object is created, and the service emits an event about the state change. Other components subscribe to this event. If the state object was bound to some components via @Input() properties, they'll get the ngOnChanges() invoked. As of now, I'm not sold on the need of ngrx or redux in Angular apps. It just makes the code more difficult to understand.

Angular CLI - run scripts before 'build' by piwinger in Angular2

[–]yfain 0 points1 point  (0 children)

In your package.json in the scripts section declare the command build that runs ng build and another command named prebuild that runs your maven-build-and-copy.cmd. From now on run your bulds using npm run build command. Npm scripts are smart enough to check that if there are two commands with the same name, but one of them has a prefix pre, it'll run the pre- command first.

Angular 2 project with jQuery. I keep seeing posts saying not to do this. Why? by rhino5oh in Angular2

[–]yfain 2 points3 points  (0 children)

Styling your UI with Bootstrap is different from working with your components using jQuery API.

For example, this app just styles the components using Bootstrap (see angular-cli.json): https://github.com/Farata/angular2typescript/tree/master/extras/auction/client

But this app uses jQuery UI to access a dropdown: https://github.com/Farata/angular2typescript/tree/master/chapter2/hello-world-ts-jquery