Fergus Gallagher
Member since Aug 21, 2015
- Profile: /members/12794-fergus-gallagher.htm
- Comments: 20
Recent Blog Comments By Fergus Gallagher
-
EXCEPTION: Token Must Be Defined! In Angular 2 Beta 1
Posted on Feb 4, 2016 at 3:51 AM
> This might not be an error you ever see if you're using ES6 modules. If one were to reference NgModel directly, one still needs to import it from the right place import {NgModel} from "angular2/common";... read more »
-
FAILURE: Using ngModel With A Custom Component In Angular 2 Beta 1
Posted on Feb 3, 2016 at 5:11 PM
@Esfand, Wow! But I have so many applications using onPush() which work so well.... read more »
-
Two-Way Data Binding Is Just A "Box Of Bananas" In Angular 2 Beta 1
Posted on Feb 3, 2016 at 3:10 PM
Error messages certainly need some work! I have a strict linter which insists on double-quotes for all strings. I did a sloppy global replace single -> double and ended up with something like: <div foo="func("bar")"></div> in a template, which resulte... read more »
-
FAILURE: Using ngModel With A Custom Component In Angular 2 Beta 1
Posted on Feb 2, 2016 at 5:36 PM
@Mike Not fixed at all. 1) Need to include the CSS 2) Also need to "unwrap" the setTimeout() near the bottom... read more »
-
FAILURE: Using ngModel With A Custom Component In Angular 2 Beta 1
Posted on Feb 2, 2016 at 3:21 PM
@Rob, Aurelia is totes awesome (love it, love it, love it) but as a jobbing programmer I am compelled to follow the herd. Sadly, I've never seen a job description requiring Aurelia, yet Angular ones flood my inbox. Pragmatism.... read more »
-
FAILURE: Using ngModel With A Custom Component In Angular 2 Beta 1
Posted on Feb 1, 2016 at 2:40 PM
Ah! I commented out the css as a tl;dr; :-(... read more »
-
FAILURE: Using ngModel With A Custom Component In Angular 2 Beta 1
Posted on Feb 1, 2016 at 2:05 PM
(And, of course, unwrap that setTimeout() at the bottom)... read more »
-
FAILURE: Using ngModel With A Custom Component In Angular 2 Beta 1
Posted on Feb 1, 2016 at 2:02 PM
Add this to AppComponent({....}). Line 80 above. changeDetection: ng.core.ChangeDetectionStrategy.OnPush,... read more »
-
Directive Output Bindings Use "$event" For Dependency-Injection In AngularJS 2 Beta 1
Posted on Jan 31, 2016 at 7:03 AM
@Ben, @Esfand Custom events are quite straightforward (in ES6 at least!). Simply create a service wrapping an EventEmitter then emit(), subscribe() to that. For an example see: https://github.com/fergusg/my-ng2-sandbox/tree/master/src/app/components/events (Warning, this is my "playgroun... read more »
-
Directive Output Bindings Use "$event" For Dependency-Injection In AngularJS 2 Beta 1
Posted on Jan 30, 2016 at 10:34 AM
You will know by now that such events don't bubble - you need a more generic "message bus" to communicate between arbitrary components.... read more »
-
AngularJS 2 Beta 1: Hello World With ES5 And RequireJS
Posted on Jan 28, 2016 at 1:28 PM
> I am not sure there is any other way to keep it all in one page If it's just the `` string templates that offend ES5, you can still use plain ole multiline "aaa" + "bbb" + .... (though obviously far less readable).... read more »
-
AngularJS 2 Beta 1: Hello World With ES5 And RequireJS
Posted on Jan 28, 2016 at 2:48 AM
@Mohamed You can't polyfill syntax (afaik). However, most evergreen browsers support many E56 features - template strings being one of the more ubiquitous. http://kangax.github.io/compat-table/es6/#template_strings Pity we can't rely on that in most production apps, hence transpilers.... read more »
-
Component Life-Cycle Methods Need To Be Defined On The Prototype In AngularJS 2 Beta 1
Posted on Jan 25, 2016 at 4:42 PM
I think Martin is right. I respectfully suggest you should stop thinking that Angular2 is Angular1 v2 and embrace ES6 (or, even better, Typescript)... read more »
-
Component Inputs Provide Both Property And Attribute Bindings In AngularJS 2 Beta 1
Posted on Jan 25, 2016 at 1:45 PM
Not sure, but I think your reference to "attribute bindings" might be wrong or misleading. In the same doc you linked to it seems to say you need to use [attr.xxxx] to bind to an attribute vs. a property. But I must admit I still haven't fully got my head around attributes vs. props, t... read more »
-
Component Life-Cycle Methods Need To Be Defined On The Prototype In AngularJS 2 Beta 1
Posted on Jan 23, 2016 at 11:55 AM
I think the problem with your original LCInstanceController is that "this" refer LCInstanceController but NG is looking for ngOnInit() on the LCInstanceComponent "class". The scoping is out of whack.... read more »
-
Component Life-Cycle Methods Need To Be Defined On The Prototype In AngularJS 2 Beta 1
Posted on Jan 23, 2016 at 10:55 AM
I think you might be thinking too much in an NG1 "controller" way. This works nicely, I think: var LCInstanceComponent = ng.core .Component({ selector: "life-cycle-instance", template: `...` }) .Class({ constructor: function() { ... read more »
-
AngularJS 2 Beta 1: Hello World With ES5 And RequireJS
Posted on Jan 23, 2016 at 8:02 AM
@Ben, Here's a way you can do in browser ES5->ES6 transpilation. http://codepen.io/fergusg/pen/rxJzXg... read more »
-
Conditionally Canceling Href Navigation Using Directives In AngularJS
Posted on Nov 28, 2015 at 1:04 PM
@Ben, I got it to work in ng2 - satisfyingly concise, clear and elegant in the end. MUCH more so than ng1, IMHO. (I won't clutter here with my solution, so bump me if anyone's interested. Cynical at first, ng2+typescript is growing in me.)... read more »
-
Conditionally Canceling Href Navigation Using Directives In AngularJS
Posted on Nov 27, 2015 at 11:00 AM
I've been trying to do something similar in Ng2, but preventDefault() doesn't seem work with [router-link] :-(... read more »
-
TypeError: Cannot Read Property "childNodes" Of Undefined In AngularJS
Posted on Aug 21, 2015 at 11:01 AM
I wonder if you could move ng-app directive deeper into the DOM (onto body tag, perhaps) and/or move the 3rd party script tag to the end of the DOM.... read more »