Skip to main content

ExpertSystem

Member since Nov 11, 2014

Recent Blog Comments By ExpertSystem

  • Cross-Site Request Forgery (CSRF / XSRF) Race Condition In AngularJS

    Posted on Feb 8, 2016 at 9:01 AM

    I don't think there is any race condition going on inside Angular (in this particular case at least :P). As @ben said, the code between reading the cookie and calling `xhr.send()` is all synchronous. I'd say it's a rather typical network race condition. I suspect here's what'g going on: 1. Current... read more »

  • Refactoring bnRepeatSwitch To Use A Multi-Priority Directive In AngularJS

    Posted on Dec 23, 2014 at 8:13 AM

    Originally I didn't pay much attention to the fact that you need one directive to act on the template and one to act on the cloned instances. I realize my suggestion won't work (because my proposed directive's postLink function will act on the original element (at that time replaced by ngRepeat wit... read more »

  • The "Post-Link" Function Is The "Link" Function In AngularJS Directives

    Posted on Dec 23, 2014 at 3:12 AM

    It might be worth noting that basically the `link` property is just a shorthand for when the `compile` function is empty (which is the majority of times). "Normally", the linking function(s) are specified as the return value of the `compile` function, which can be either a (post-link) func... read more »

  • Refactoring bnRepeatSwitch To Use A Multi-Priority Directive In AngularJS

    Posted on Dec 19, 2014 at 10:10 AM

    The description of the `priority` property sheds some more light ( https://docs.angularjs.org/api/ng/service/ $compile#-priority-): > Directives with greater numerical priority are compiled first. Pre-link functions are also run in priority order, but post-link functions are run in reverse order... read more »

  • Refactoring bnRepeatSwitch To Use A Multi-Priority Directive In AngularJS

    Posted on Nov 14, 2014 at 9:12 AM

    @Ben, I have no idea about pre 1.2.x, so you might be right. Not sure if any use-case would cause a conflict (probably none). The main points imo are two: 1. The order doesn't seem to play a significant role and everything works fine although the link functions execute in the opposite order than ... read more »

  • Refactoring bnRepeatSwitch To Use A Multi-Priority Directive In AngularJS

    Posted on Nov 11, 2014 at 11:58 AM

    Hm...in your comments you seem to imply that the higher a directive's priority the sooner it gets compiled **and** linked. I just wanted to point out that the order* of each phase is as follows: 1. Compile (in descending priority order). 2. Instantiate controller (in descending priority order). 3.... read more »

I believe in love. I believe in compassion. I believe in human rights. I believe that we can afford to give more of these gifts to the world around us because it costs us nothing to be decent and kind and understanding. And, I want you to know that when you land on this site, you are accepted for who you are, no matter how you identify, what truths you live, or whatever kind of goofy shit makes you feel alive! Rock on with your bad self!
Ben Nadel