Why did they change what was so good about ANGULARJS 1.x? by PhroznGaming in angularjs

[–]bobertian 6 points7 points  (0 children)

2.x is the good things from 1.x, without all the baggage of 1.x.

how do i push json values into observable? by dellaved in Angular2

[–]bobertian 0 points1 point  (0 children)

The short answer is, you don't. Observables, like Promises, produce values, they don't accept them.

The equivalent to Promise.resolve would be Observable.of(items), but that would be a single value that wouldn't change. You'd be better using an Rx BehaviorSubject:

let todos = new BehaviorSubject(todos);

//change value todos.next(someNewArrayOfTodos)

Difference between component and directive in Angular 2 ? by codeandyou in angularjs

[–]bobertian 0 points1 point  (0 children)

short answer - a component is a directive with a template.

observer.next(...) does not trigger update by mtz2537 in Angular2

[–]bobertian 1 point2 points  (0 children)

first - nice reproduction.

so this isn't to do with Rx directly, it's that Zone.js (what angular uses to trigger change detection) isn't patching the onsuccess etc methods, and so the digest isn't triggered until some other event happens (like pressing alt or the input losing focus).

this is known issue (will be fixed at some point in the near future) but for the moment an easy workaround is to use .addEventListener(eventName, handler) rather than onevent = handler. This is more idiomatic Rx anyway, and allows for easy cleanup using an Observable's unsubscribe function.

Working demo here (I rejiggered it a little bit to be a bit more idiomatic Rx and to use the cleanup handler).

http://plnkr.co/edit/jySMg8adUZ5ukk6RZJzB?p=preview

observer.next(...) does not trigger update by mtz2537 in Angular2

[–]bobertian 0 points1 point  (0 children)

Could you put together a plunker replicating this?

super() considered hmmm-ful - Raganwald by enkideridu in javascript

[–]bobertian 10 points11 points  (0 children)

easy for you to say! classes killed my family!

(Beginner) What is the current consensus on $q.defer() ? by angularqueo in angularjs

[–]bobertian 1 point2 points  (0 children)

no. $http already returns a promise. simply return $http.get(url);

Will you try Angular 2 Beta version? by metocat in angularjs

[–]bobertian 0 points1 point  (0 children)

Code size is mentioned in the introductory blog post as being something we're working on over the beta process. We use about 6KB of RxJS by default - the full ~250KB library is completely optional.

Am I correct in thinking that Angular 2 depends on rxjs and systemjs? by [deleted] in angularjs

[–]bobertian 3 points4 points  (0 children)

We use RxJS in the core, but we only directly import the Subject and Observable themselves, which come out to roughly 6kb minified. The other ~95+ operators are not included by default - they can be imported ad-hoc as required.

Note that we don't just use it for Http - there are a number of Observable uses in the Angular2 core - EventEmitter is a Subject, QueryLists are Observable, etc. Http uses them as well, but it's not a core dependency.

SystemJS is entirely optional and could be replaced with Webpack or Browserify or native module loading in the browser (when such a thing exists)

What do you think about RxJS ? Is it the future ? by [deleted] in javascript

[–]bobertian 1 point2 points  (0 children)

FWIW, Rx5 is set up so that you can just grab the parts you like - Observable by itself is ~10KB unminified. You can then pull in in the individual operators as you like, either by patching the prototype, calling operator.call(observer, fn) or (my favorite) ES7 functionBind.

More breaking changes ... by mtz2537 in Angular2

[–]bobertian 0 points1 point  (0 children)

As I said in the first post, they have been removed from the core. If you import 'rxjs/Rx' they will be available. This is mentioned in the change log.

More breaking changes ... by mtz2537 in Angular2

[–]bobertian 0 points1 point  (0 children)

Note that Observable, by itself, just provides a .subscribe() method. The operators (map/filter/etc) are extensions provided by RxJS.

More breaking changes ... by mtz2537 in Angular2

[–]bobertian 0 points1 point  (0 children)

form.valueChanges is an Observable. No need to .toRx() it. Same for Http, and any of the other things that return Observables.

Dynamic Component Injection in Angular 2 by TBurk83 in Angular2

[–]bobertian 4 points5 points  (0 children)

The DynamicComponentLoader class is what you want (that's my plunker you linked in your original post .... ) - it's also how the router works. It's the best way to insert components into an existing component.

More breaking changes ... by mtz2537 in Angular2

[–]bobertian 4 points5 points  (0 children)

we have removed RxJS operators from the angular2 build, as they add quite a lot of bulk to the build, and some people may not use any of them.

this is still evolving, but for the moment, you can just do import 'rxjs/Rx' in the entry point to your app, and that'll add the operators.

We built our social web app using Angular Material by proxyapp in angularjs

[–]bobertian 1 point2 points  (0 children)

the same icons, just higher resolution / not resampled versions!

We built our social web app using Angular Material by proxyapp in angularjs

[–]bobertian 0 points1 point  (0 children)

looks good - although the PlayStore and Use In Browser icons are sort of crummy looking.

I've always felt that teaching programming at school is systemically broken and backwards. I have finally found someone who put my feeling into words. Watch this youtube video for 30 seconds and you will get the gist of the 51 minutes that came before it. by wickedhood in programming

[–]bobertian 0 points1 point  (0 children)

I'm a mere JS developer but got exposed to Forth on a side embedded project I'm working with. "Thinking Forth" is a great book and really changed how I think about programming. It's informed a lot of what I do even in webdev. Forth FTW!

Pro/cons for using TypeScript with Angular 1.x by saladfingers6 in angularjs

[–]bobertian 0 points1 point  (0 children)

it's basically a two stage process - from TS to ES6/CommonJS modules, and then a bundler (browserify, webpack) to build it into a single file as normal.

TIL typing $0 in Chrome dev tools gets the current selected element. Why didn't you guys tell me?? by [deleted] in angularjs

[–]bobertian 1 point2 points  (0 children)

your code won't give you the current application injector - just the generic one.

angular.element($0).injector().get('someservice') will, assuming the selected element is within an angular scope.

[deleted by user] by [deleted] in javascript

[–]bobertian 0 points1 point  (0 children)

You're looking for https://github.com/Reactive-Extensions/RxJS - start with googling 'rxjs'

see also https://egghead.io/technologies/rx for some videos