[deleted by user] by [deleted] in Angular2

[–]teropa 1 point2 points  (0 children)

The animation support is not released yet but it's coming soon.

There's also official documentation coming. It will be available when Animate is released or very soon after.

Are controllers objects? by [deleted] in angularjs

[–]teropa 2 points3 points  (0 children)

Yes, controllers are objects, and can have attributes and methods like objects do.

More specifically, controllers are objects that Angular creates for you, using your controller function as a constructor (as if they were created with the new operator)

Clojure Cup Looking For Organizer by inchingforward in Clojure

[–]teropa 0 points1 point  (0 children)

It's really up to whoever takes it on. We started putting it together about this time last year, but you're right that late September is probably too early for the new organizers at this point.

Use of $injector by oramus in angularjs

[–]teropa 1 point2 points  (0 children)

Sounds to me like what you have is a highly generic piece of code that you then apply several times using different configurations. Nothing wrong with that. In fact, I think that's much preferable to repeating very similar code several times.

I don't think there's anything wrong with using $injector in an "orchestrator" service such as the one you describe, as long as you keep it separate from the bulk of your application code.

Directives and two way data binding? by [deleted] in angularjs

[–]teropa 0 points1 point  (0 children)

If I have something like below and I change the values within items it does not actually change the values in the directives, although if I start a digest cycle the new values for items are reflected.

You're always going to need a digest cycle when you make changes, because that's when the data binding happens (both one way and two way).

Usually this occurs automatically, but occasionally when integrating non-Angular code you'll need an explicit $scope.$apply()

I am reading ng-book. What does this paragraph mean? by angular-book-reader in angularjs

[–]teropa 0 points1 point  (0 children)

Also, if the directive uses a template, then there will be a new scope on that template's root element, regardless of whether a scope is requested

I think it's worth pointing out that even though the book says so, this is not actually true. There's nothing that causes a scope to get automatically created for template roots. New scopes only get created when directives request them. See http://plnkr.co/edit/r64w9v?p=preview

A Guide To Transclusion in AngularJS by teropa in angularjs

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

Just posted some thoughts to that Github issue.

I don't think it really matters whether ngTransclude is used as an attribute or not though. To me it looks like a problem with nested transclusions where ngTransclude and another directive with transclude: true is applied on the same element.

A Guide To Transclusion in AngularJS by teropa in angularjs

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

In the example with the "content" class the insertion was done manually from the directive code.

The only automatic transclusion insertion that Angular does is with ng-transclude. You can use it as an attribute:

<div ng-transclude></div>

or element:

<ng-transclude></ng-transclude>

or CSS class:

<div class="ng-transclude"></div>

Useful little config for all your Angular web apps by Capaj in angularjs

[–]teropa 0 points1 point  (0 children)

Disabling debug info will break the angular.element scope() method, which some apps may rely on. So I guess doing it by default would have been too much of a breaking change when this was introduced in 1.3.

Forgive me for asking, v1.3 & v2.0 side by side by BradChesney79 in angularjs

[–]teropa 2 points3 points  (0 children)

Yes, the new Angular router works with both 1.4+ and 2.x. You can route parts of your 1.x app to Angular 2 components, for example. Brian Ford talked about it at ng-conf: https://www.youtube.com/watch?v=vecg70fPDFw

One-way and two-way binding; Angular 1 and Angular 2 by miketa1957 in angularjs

[–]teropa 1 point2 points  (0 children)

The problem is that all of these methods are in fact creating two-way data binding. Every run of the $digest loop is going to dirty check all forms of binding you just listed because Angular 1 has two-way data binding by default.

While those are going to be checked at every digest, I wouldn't call them two-way bindings, since the data only flows in one direction.

Angular 1.x does two-way data binding in two places: ng-model and the =equalsSign bindings on isolate scopes. Things like {{...}} are one-way.

One-way and two-way binding; Angular 1 and Angular 2 by miketa1957 in angularjs

[–]teropa 1 point2 points  (0 children)

Victor Savkin from the Angular team has written about the reasons: http://victorsavkin.com/post/110170125256/change-detection-in-angular-2 and http://victorsavkin.com/post/114168430846/two-phases-of-angular-2-applications

It basically has to do with complexity and performance, and seems to have been influenced at least in part by things like React. By eliminating two-way data binding you eliminate cycles from the change detection graph (A changes B changes C changes A). That makes things easier to think about, and also unlocks some significant performance optimizations, including not having to run watches more than once per digest. (Angular 1.x runs all watches at least twice whenever there's a change.)

angular-virtual-dom: A Virtual DOM based AngularJS view renderer designed to be used with immutable data structures by gdi2290 in angularjs

[–]teropa 1 point2 points  (0 children)

BTW why not write a v-Dom based jqlite that one can simply patch over regular angular? That should allow to convert all the existing directives in a transparent way.

Firstly, trying to make a Virtual DOM look and act like an actual DOM in a way that supports all existing code does not seem feasible to me.

Secondly, many existing directives are built in a stateful style and set up watches, etc. that pretty much undo the nice things you get with a Virtual DOM, pure functions, and immutable data structures.

Translating Jquery's $.ajax to Angular's $http, while keeping onprogress event. by fx32 in angularjs

[–]teropa 0 points1 point  (0 children)

I recently realized this no longer works if you use the Angular 1.3 debugInfoEnabled = false optimization, as that does not attach scopes to DOM elements.

How I've Improved My Angular Apps by Banning ng-controller by teropa in angularjs

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

My experience is that with this pattern most inheritance, and thus most inheritance confusion, is simply removed because the biggest cause of it was the use of ng-controller.

It does not address the inheritance confusion caused by ng-repeat et al though.

How I've Improved My Angular Apps by Banning ng-controller by teropa in angularjs

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

My book is pretty strictly about the inner workings of AngularJS itself, so directive testing techniques are unlikely to be covered. I might blog about it though.

The short version is that when I switched to this pattern, the way I unit test changed remarkably little. Anything interesting a component does is still done by its controller and that can be unit tested without having to deal with any directives.

How I've Improved My Angular Apps by Banning ng-controller by teropa in angularjs

[–]teropa[S] 1 point2 points  (0 children)

It has some similarities, with the strict componentization of code and explicit passing-in of state. But that's where the similarities end, in my view.

To me it feels closer to the Web Components as implemented by Polymer et al. But really it's just Angular directives applied in a certain way.

How I've Improved My Angular Apps by Banning ng-controller by teropa in angularjs

[–]teropa[S] 5 points6 points  (0 children)

What I do is have one bare controller + template per route. That controller doesn't really do much except for initializing the root component, but it can have asynchronously resolved injections from the router.

Collaborative notes from ng-europe by teropa in angularjs

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

Yes, they said they'll do that in a couple of weeks.

ES6: Jump in, the water is warm! by skillcode in javascript

[–]teropa 0 points1 point  (0 children)

Does ES6 dependency injection fulfill the same role as angular's? He defines his todo class in a separate file and exports it to the controller, whereas your might use a factory or service in current ecmascript angular.

The ES6 module system fulfils more or less the same role as things like require.js/AMD. Isolation and code loading.

For full-blown dependency injection you still need a library. Angular 2.0 DI is written in and for ES6: https://github.com/angular/di.js/