[AngularJS] Re: number validation only works if required

2014-02-16 Thread Daniel Tabuenca
The fundamental issue is that some browsers will return an empty string when a numeric input type has invalid data, therefore angular will only see an empty string and consider the element valid. The sample you posted works in firefox for me, but not in chrome. Some workarounds would be to

Re: [AngularJS] Re: when digest cycles run

2014-02-16 Thread Daniel Tabuenca
. On Sun, Feb 16, 2014 at 12:29 PM, Daniel Tabuenca dtab...@gmail.comjavascript: wrote: Your list is fine, but I question the usefulness of compiling an exhaustive list of every time that $digest is called, especially since third-party directives could add additional services and callbacks

[AngularJS] Re: non scope functions and variables

2014-01-09 Thread Daniel Tabuenca
Declaring private/internal functions and variables like you did is perfectly legitimate use of Javascript. You can even declare functions like this: function controller( $scope ){ $scope.var; var myvar = 'Hello world'; function myfunction(){ alert('Hello world'); } } -- You received

[AngularJS] Re: Directive compile function: setting ngModel

2014-01-09 Thread Daniel Tabuenca
The actual resume of compile is when you call $compile, not when you link the result. You have to make sure you don’t resume until you added the attribute you want in the link function. .directive('foo', function($compile) { return { restrict: 'A', priority: , terminal:

[AngularJS] Re: How to use hrefs without triggering ui-router.

2014-01-06 Thread Daniel Tabuenca
I’ve done it both ways and I think they are both valid ways of doing it. The easiest, is obviously just loading everything and showing/hiding tabs based on which one got clicked. If you are using ZURB, the common thing to do is to use their markup, but write the actual behavior in angular.

[AngularJS] Re: Is nested controllers better or a single controller for this example?

2014-01-05 Thread Daniel Tabuenca
Having a complex system of watches and event handlers to try to keep data in sync is usually too much complexity with very little return value. On the other hand, we’d like to stay true to the “principle of least knowledge” (or law of demeter), and only give each section access to the data

[AngularJS] Re: complex names for input fields to use in ng-show.

2014-01-04 Thread Daniel Tabuenca
You simply need to quote the string and access it using the array syntax: ng-show=create_form['phones['+$index+'].number'].$dirty That being said, is there a reason why you have to name forms like that? Are you submitting these forms to the server through a standard form post and require

Re: [AngularJS] Re: angular custom directive sequence

2014-01-03 Thread Daniel Tabuenca
You can use a pre-link function instead of the default post-link function like this: app.directive(log, function() { return { link: { pre: function(scope, element, attrs) { console.log(PRE LINKED + attrs.name); }, post: function(scope, element, attrs) {

[AngularJS] Re: window.execCommand acting quirky

2014-01-03 Thread Daniel Tabuenca
The problem is in your blur handler. Here's the sequence: 1. You select the cruel word 2. You click on the **bold** button 3. The blur event gets triggered 4. ctlr.$setViewValue(Hello cruel editable world!) is called but since the value is the same as it was before, the view is not re-rendered

[AngularJS] Re: $httpBackend.whenGET() passThrough() not actually passing through for me

2014-01-03 Thread Daniel Tabuenca
Cross posting from SO: I’m not trying to be snarky, bu I really do think you are mis-understanding the purpose of the $httpBackend that is in the ngMockE2E module. This is not a matter of opinion, the ngMockE2E module is simply not designed nor intended to be used from within a jasmine

Re: [AngularJS] Re: Security in Angular.js

2014-01-02 Thread Daniel Tabuenca
I'm not sure how MD5 would prevent the kind of attack he is proposing though. If the hacker has access to script source and can poison caches they would presumably be able to edit the invocation of any MD5 hash encoding and otherwise do anything else the application is normally allowed to do.

Re: [AngularJS] Re: Security in Angular.js

2014-01-02 Thread Daniel Tabuenca
But this calculation is client-side. If the attacker has full access to client-side scripts, they can easily ajax in the server-script, run an md5 on it and return that (while what's actually executing on the browser is the compromised script). On Thursday, January 2, 2014 9:33:06 AM UTC-8,

Re: [AngularJS] Re: Security in Angular.js

2014-01-02 Thread Daniel Tabuenca
Yeah, just want to make sure the original poster understands that MD5 will not solve the particular scenario he presented. SSL would go further, but still he should still be fully validating any request on the server. -- You received this message because you are subscribed to the Google

[AngularJS] Re: Talking to services

2014-01-02 Thread Daniel Tabuenca
A few things to consider: If checkboxHandler is meant to be a generic directive where what is done when something is changed can vary, then you would pass in the method to call in your HTML and wire it up through the isolate scope of your directive. If checkboxHandler is always meant to use

Re: [AngularJS] Re: ngTransclude orphaning bug?

2014-01-02 Thread Daniel Tabuenca
Yeah, that might be a good idea to suggest on the dev list. `ng-transclude` is a very simple and naive directive. I can imagine many situations where it would be hard for it to know what you mean without being explicit about it. -- You received this message because you are subscribed to the

Re: [AngularJS] Re: idiomatic angular: services and promises

2014-01-02 Thread Daniel Tabuenca
Yeah promises are great because they map perfectly with the asynchronous nature of the browser platform. Netflix has been very successfully using promises on the server side as well. Almost all of their server-side services are promise-based which has proved invaluable to adapting to

[AngularJS] Re: angular custom directive sequence

2014-01-02 Thread Daniel Tabuenca
Angular starts at the root node of the application (where ng-app is) and goes down the tree node-by-node. For each node it encounters it tries to determine all the directives that are on that node. If it finds multiple directives on one node it will order them by greatest to least priority

[AngularJS] Re: ngTransclude orphaning bug?

2014-01-01 Thread Daniel Tabuenca
I’ve spent some time with the angular code today looking at how transclusion is implemented, and it can get pretty complicated. The ng-transclude directive is pretty simple, it just takes the transclude function injected into the current context and calls it. However, when you have a

[AngularJS] Re: Recompiling form causing issues

2014-01-01 Thread Daniel Tabuenca
I was able to see some of the previous code in the plunker history. I don’t know if it will solve your problem or not, but it’s probably better to compile the label and then attach it to the dom when you call its link function. Something like: var label= angular.element('label

[AngularJS] Re: Security in Angular.js

2014-01-01 Thread Daniel Tabuenca
Using HTTPS for serving scripts can help prevent man-in-the-middle attacks, and provide assurance that the script that is being executed came from the server specified in the SSL certificate. Angular js is no different than any other client-side technology, however, and the browser should

[AngularJS] Re: angularjs and grails.

2013-12-30 Thread Daniel Tabuenca
I'm sure there is plenty of people using angular with grails, but you will get a better response if you ask your specific question, since angular problems or issues are similar no matter what back-end you use. On Monday, December 30, 2013 3:17:44 PM UTC-8, Mauro Sanna wrote: none? On

[AngularJS] Re: expression used in ng-hide

2013-12-28 Thread Daniel Tabuenca
Angular expressions do not allow arbitrary javascript. They are intended to access properties an methods on a scope (not global properties such as navigator). In order to get what you are trying to do to work, you would have to move that logic into a controller method. For example:

[AngularJS] Re: What is the difference between module.factory and module.service and how might both be applied?

2013-12-28 Thread Daniel Tabuenca
There’s two notions at play here, one is object-oriented programming (which javascript handles quite well), the other is a static typing system (which javascript being a dynamic language doesn’t natively support). It’s important to understand that you can do object-oriented programming

[AngularJS] Re: Route resolve doesn't inject resolve result into controller

2013-12-28 Thread Daniel Tabuenca
In your controller injection list you are missing “products”. The array of strings for dependency injection needs to match the number of parameters into your controller function: *This:* var productDetailController = catalogControllers.controller('ProductDetailController', ['$scope',

[AngularJS] Re: Attribute directives as default syntax - why?

2013-12-28 Thread Daniel Tabuenca
I see where you are coming from. You have an established set of patterns which work well for you. However, in many ways angular makes a lot of these patterns potentially unecessary, and by adopting new patterns more aligned with the angular way of doing things, you can greatly reduce the

[AngularJS] Re: Route resolve doesn't inject resolve result into controller

2013-12-28 Thread Daniel Tabuenca
There are likely other problems with your code preventing it from working, but just to be sure *you do need to include ‘product’ in your DI injection array*. The DI injection arrays are not just for services, but for anything that needs to be injected by name. You can get away with not using

[AngularJS] Re: Attribute directives as default syntax - why?

2013-12-28 Thread Daniel Tabuenca
Yes, directives are fairly low-level. In that sense, saying that they “solve too many problem spaces” is like saying “functions solve too many problem spaces”. As I pointed out in the last post, they are simply a way to bind javascript to DOM, and they exist to make it easy to create

[AngularJS] Re: How to represent behaviors in AngularJS?

2013-12-27 Thread Daniel Tabuenca
This is a common question/concern by those seeing angular for the first time. In a sense, it seems as though we’ve gone backwards in time when we used to do things like: div onclick=doSomething() About the time that jquery started becoming popular, a lot of the web-development community got

[AngularJS] Re: Yet another post about inter-controller communication best practices

2013-12-26 Thread Daniel Tabuenca
Controllers are stored as data in each of the directive’s respective dom nodes. They are accessed by using the .controller('directiveName') method of angular’s jqLite wrapper. While the controller('directiveName') method will walk the tree upwards starting at the current dom element until it

Re: [AngularJS] 1.0.7 understanding the limits of double binding (within directive) and $watch sync

2013-12-23 Thread Daniel Tabuenca
Because of the way you have set up multiple watches inside and outside your directive, you’ve managed to expose a bug that I have fixed in the 1.2.x series: https://github.com/angular/angular.js/commit/2d0f6ccba896fe34141d6d4f59eef6fba580c5c2