alessandro francia | 27 Jun 01:24 2013
Picon

my first time with angular, can i ask if i'm doing it good?

Hi, first of all, i apologize for my English , i'm italian :p
in second it's my first/second  post in a google groups so I don't know if there are any policies that says  i don't have to write post like this.

now , I'm new with angular! I just worked for 2 month on Backbone and now wanna start to study angular.
and so i started this app, it's just a app for study so..sorry if it isn't tidy or similars...but i'm starting just now in this kind of world!

this is my Plunker 

i posted this also because i think can be a good step for start for new people!
ps: i ate Plunker...i spent more time to set working my app there then building it! :P

there are a lot of things in my app that i believe aren't best practices like {{$parent.$parent.item.Url+item.scope}}  
and i don't know if is good or not don't use the router and instead use ng-include, 
for any suggestion or ask i'm here!
thank you!


--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscribe <at> googlegroups.com.
To post to this group, send email to angular <at> googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Olivier Clément | 27 Jun 01:50 2013
Picon

Unit Test Controller: Injected Service is empty or undefined

Hey Folks,


So I am at the early stages of an Proof of Concept I'm working on, and trying to get unit testing right, I want to test a very simple controller that relies on a service I wrote.

Right now, all it does is the controller calls a method on the service, that returns an array to the ctrl.

I can test whatever is in the scope of the controller, which is fine. But I cannot seem to access anything related to the service I (try to) inject in there. It appears empty, as if it were an empty object.

I inlined comments to show what happens.

Feel free to clone and run 'grunt test' if you want to fiddle with this.

Thanks

--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscribe <at> googlegroups.com.
To post to this group, send email to angular <at> googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Ciro Nunes | 27 Jun 02:12 2013
Picon

Re: How would I implement retry logic in angular.js with exponential back-off?

If I understand what you need, you can use promises to control the assync flow of your requests, then you can implement a logic to retry.

Take a look at $q service docs

Em segunda-feira, 4 de fevereiro de 2013 16h02min52s UTC-2, Pavel Hlobil escreveu:

How would I implement retry logic in angular.js with exponential back-off?

What are my options?

  1. Would the right place for the logic be in $httpProvider.requestInterceptors? Can I selectively pick to use it with some $http services and not others?
  2. Extend $http object with retry method?

Newbie, just started using the framework this weekend :)

Thank you,

Pavel

--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscribe <at> googlegroups.com.
To post to this group, send email to angular <at> googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Zoom.Quiet | 27 Jun 03:26 2013
Picon

Re: Re: $resource (REST)- Many questions

On Sun, Jun 16, 2013 at 8:00 AM, Luke Kende <luke.kende <at> gmail.com> wrote:
> Sorry, have not spent much time on testing yet with angular, as I also have
> had to dive and focus on building a functional app.
>

- yep, same feel
- but $http is very like native code
- we can usage $http at first, and try understand $resource again,,,

>
> On Sat, Jun 15, 2013 at 5:34 PM, Matt Madhavan <mattmadhavan <at> gmail.com>
> wrote:
>>
>> Hi Luke,
>> I really appreciate your reply and I got it. Even though I am new to the
>> Javascript world I did spend some time on DOJO before I came into the
>> AngulaJS world. I gave up on DOJO due to the lack if doc and support like
>> this. I do understand the concept of deferred/promise  etc due to my
>> 'limited' background in DOJO.
>>
>> I did read the documentation (:)). Just was in a hurry to deliver a demo.
>>
>> I have posted another question regarding testing! Can you please take look
>> at it and offer some advise ? Would really appreciate it! The following is
>> the link!
>>
>> https://groups.google.com/forum/?fromgroups#!topic/angular/6rW32q6oPXk
>>
>> Thanks
>> Matt'M
>>
>>
>> On Saturday, June 15, 2013 4:32:58 AM UTC-5, Luke Kende wrote:
>>>
>>> Have you actually tried it in a controller to find out? Did you read the
>>> examples at http://docs.angularjs.org/api/ngResource.$resource ?  It makes
>>> sense once you play with simple versions and then build up to there
>>> examples... if you don't understand $resource, don't worry with putting it
>>> in a service yet, and don't worry about $q until you understand the other
>>> two.
>>>
>>> You can make all those calls the one simple resource object:
>>>
>>>
>>> function TestCtrl($scope,$http,$resource,$q){
>>>
>>>    var Phones = $resource('http://api.yourdomain.com/phones/:phoneId')
>>>
>>>    //Say your api URL for listing array of phones looks like this:
>>> http://api.yourdomain.com/phones
>>>    $scope.phones = Phones.query(function(data){ ...success handler
>>> code... },function(response){ ..error handler code... })
>>>
>>>    //Say your api URL for an individual phone by id looks like this:
>>> http://api.yourdomain.com/phones/123
>>>     var singlePhone = new Phone();
>>>     singlePhone.$get({phone_id: 123},function(data){ ..success...
>>> },function(data){ ..error... })
>>>
>>>     //Say your api URL for listing all phones for Mat like this:
>>> http://api.yourdomain.com/phones?owner=mat
>>>     //notice doesn't have to have success and error callbacks provided
>>>     //any object properties given not matching the URL template (like
>>> :phoneId) get appended as GET params, like ?owner=mat
>>>     $scope.MatsPhones = Phones.get({owner:'mat'});
>>>
>>>    //using a promise to do stuff with data after success - just making up
>>> an example
>>>    function getPhonesByType(type){
>>>        var p = [];
>>>        var deferred = $q.defer();
>>>        Phones.query(
>>>             function success(phones){
>>>                angular.forEach(phones,function(phone){
>>>                    if (phone.type == type) p.push(phone);
>>>                })
>>>                deferred.resolve(p);
>>>            },
>>>            function error(){
>>>                deferred.reject()
>>>            }
>>>        ); //end phones resource call
>>>
>>>        return deferred.promise;
>>>     }
>>>
>>>     //now can use 'then' statement with the function that returns a
>>> promise
>>>     $scope.androidPhones = []
>>>     getPhonesByType('android').then(function(data){ $scope.androidPhones
>>> = data});
>>> }
>>>
>>>
>>>
>>> On Friday, June 14, 2013 1:29:17 PM UTC-6, Matt Madhavan wrote:
>>>>
>>>> Hello,
>>>> I am not quite sure how to create services and consuming controllers
>>>> based on $reource.
>>>>
>>>> Can some one please explain the following syntax?
>>>>
>>>>> angular.module('phonecatServices', ['ngResource']).
>>>>> factory('Phone', function($resource){
>>>>>     return $resource('phones/:phoneId.json', {}, {
>>>>>         query: {method:'GET', params:{phoneId:'phones'}, isArray:true}
>>>>>     });
>>>>> });
>>>>>
>>>>
>>>> Seems like I can query for all the phones and query for a phone with a
>>>> particular phone ID (?phoneId=xxxx). How about if I want to query all the
>>>> phones that are owned by 'Matt' (assuming owner is an attribute of phone).
>>>> How do I query for it ? (?owner='Matt');
>>>> No promises?
>>>> How do I know if the call failed? How do I take care of error
>>>> conditions? For instance if there are no phones for 'Matt' I would like to
>>>> navigate back to the Search Page.
>>>>
>>>> Also in the following snippet (From the AngularJS book)
>>>>>
>>>>> services.factory('Recipe', ['$resource',
>>>>>     function($resource) {
>>>>>   return $resource('/recipes/:id', {id: ' <at> id'});
>>>>> }]);
>>>>>
>>>>> services.factory('MultiRecipeLoader', ['Recipe', '$q',
>>>>>     function(Recipe, $q) {
>>>>>   return function() {
>>>>>     var delay = $q.defer();
>>>>>     Recipe.query(function(recipes) {
>>>>>       delay.resolve(recipes);
>>>>>     }, function() {
>>>>>       delay.reject('Unable to fetch recipes');
>>>>>     });
>>>>>     return delay.promise;
>>>>>   };
>>>>> }]);
>>>>
>>>>
>>>> When do I use the above scenario as opposed to the above one (Phone).?
>>>> The difference between the syntax's?
>>>> I guess the second part of the second second snippet makes it a
>>>> 'promisable'. But on the controller side how do I wait till it gets resolved
>>>> with an error? Or how does the controller know? Can it start using the
>>>> promise as soon as the call is returned?
>>>>
>>>> I am a little confused! Any answers pointers will be greatly
>>>> appreciated.
>>>>
>>>>
>>>> Thanks in advance!
>>>>
>>>> Matt'M
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "AngularJS" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/angular/dzt_7MD5pCE/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> angular+unsubscribe <at> googlegroups.com.
>>
>> To post to this group, send email to angular <at> googlegroups.com.
>> Visit this group at http://groups.google.com/group/angular.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "AngularJS" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to angular+unsubscribe <at> googlegroups.com.
> To post to this group, send email to angular <at> googlegroups.com.
> Visit this group at http://groups.google.com/group/angular.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

-- 
人生苦短, Pythonic! 冗余不做,日子甭过!备份不做,十恶不赦!
KM keep growing environment culture which promoting organization be learnning!
俺: http://about.me/zoom.quiet
许: http://creativecommons.org/licenses/by-sa/2.5/cn/

--

-- 
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscribe <at> googlegroups.com.
To post to this group, send email to angular <at> googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.

johntom | 27 Jun 03:39 2013
Picon

Re: ng-grid - Programatically selecting rows how and other API's etc

Hi Matt,

Why don't you post this on https://github.com/angular-ui/ng-grid
HTH
John

On Wednesday, June 26, 2013 4:50:43 PM UTC-4, Matt Madhavan wrote:
Hello,
Any one out there please?

Thanks
Matt

On Tuesday, June 25, 2013 7:02:22 PM UTC-5, Matt Madhavan wrote:
Hello,
I would like to Select the first row of the ng-grid after all the rows are added to the Grif from within the Controller.

The only option I see is to wait on a Grid Event - like ngGridEventData to occur, and select the row as follows(in the blue color)

            $scope.gridOptions = {
                    data: 'members',
                    showSelectionCheckbox: true,                    
                    multiSelect: true,  
                    enableColumnResize:true,
                    jqueryUITheme:true,
                          columnDefs: [
                                  {field:'Member', displayName:'Member'},
                                  {field:'Relationship', displayName:'Relationship'},
                                  {field:'DOB', displayName:'Date Of Birth'},
                                  {field:'SSN', displayName:'SSN'},
                                  {field:'Gender', displayName:'Gender'},
                                  {field:'MemberID', displayName:'ID'}
                    ]
            };                
           
            $scope.$on('ngGridEventData', function(){
                $scope.gridOptions.selectRow(0, true);
            });


Problem is the Event ngGridEventData is called once for every row in the Grid. Only after the Grid is fully initialized the gridOption is initialized with the methods like selectRow etc.

  1. Is there any other better event from the ng-grid that is 'emitted' only when (and only once) after the Grid is fully initialized?
  2. Is this the only way (via gridOptions) to do any programmatic access to the Grid?
  3. Are there any additional documentation detailing the the ng-grid's design, lifecycle and API besides the WIKI page?

Spending lot of time on ng-grid because of ;lack' of documentation. One of the primary reason why I quit DOJO and moved to AngualrJS was because of the Documentaion and support. But in ng-grid I am kind of struggling a bit.

And any pointers on how to perform E2E testing on ng-grid like testing for first row selected etc will be appreciated.

I appreciate in advance!


Thanks

Matt'M

--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscribe <at> googlegroups.com.
To post to this group, send email to angular <at> googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Jose Luis Rivas | 27 Jun 03:43 2013
Picon

Keep track of an upload with $http?

With an XHR object in JavaScript you can access directly to xhr.upload and put an EventListener to it and
from this create progress bars. 

Can I do the very same thing in $http.put/$http.post? 

--

-- 
Jose Luis Rivas

AJ Mercer | 27 Jun 04:07 2013
Picon

headers returned from $resource - not getting all of them

I have worked out how to get the headers in a response from $resource - but it is not giving me everything

I get this
{last-modified: "Thu, 27 Jun 2013 02:03:29 GMT", content-type: "application/json;charset=UTF-8", cache-control: "none", expires: "Thu, 27 Jun 2013 02:03:29 GMT"}

But when I look at the response in Chrome dev tools there are a lot more

  1. Access-Control-Allow-Credentials:
    true
  2. Access-Control-Allow-Headers:
    content-type, accept,origin,token,authorization
  3. Access-Control-Allow-Methods:
    GET, OPTIONS
  4. Access-Control-Allow-Origin:
  5. Cache-Control:
    none
  6. Connection:
    close
  7. Content-Length:
    1703
  8. Content-Type:
    application/json;charset=UTF-8
  9. Date:
    Thu, 27 Jun 2013 02:03:29 GMT
  10. ETag:
    B026519B7373A1759530A7767453BE32
  11. Expires:
    Thu, 27 Jun 2013 02:03:29 GMT
  12. Last-Modified:
    Thu, 27 Jun 2013 02:03:29 GMT
  13. Return-Format:
    json
  14. token:
    2F74ADC9-D5BF-4F1B-949EA298B2BE18D0

Ho can I get' ETag' and 'token'?

--

AJ Mercer
<webonix:net strength="Industrial" /> | <webonix:org community="Open" />
http://twitter.com/webonix

--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscribe <at> googlegroups.com.
To post to this group, send email to angular <at> googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Ricardo Bin | 27 Jun 04:45 2013
Picon

[AngularJS] AngularJS Meetup in São Paulo/Brazil

We are organizing an AngularJS meetup in São Paulo/Brazil in the next few months.


If someone have interest -> http://www.meetup.com/AngularJS-Sao-Paulo/

=D

--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscribe <at> googlegroups.com.
To post to this group, send email to angular <at> googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Ricardo Bin | 27 Jun 04:50 2013
Picon

Re: Unit Test Controller: Injected Service is empty or undefined

Hi,


I just have a quick look to your code... Did you try to use spyOn instead of jasmine.spyOn ?

Em quarta-feira, 26 de junho de 2013 20h50min37s UTC-3, Olivier Clément escreveu:
Hey Folks,

So I am at the early stages of an Proof of Concept I'm working on, and trying to get unit testing right, I want to test a very simple controller that relies on a service I wrote.

Right now, all it does is the controller calls a method on the service, that returns an array to the ctrl.

I can test whatever is in the scope of the controller, which is fine. But I cannot seem to access anything related to the service I (try to) inject in there. It appears empty, as if it were an empty object.

I inlined comments to show what happens.

Feel free to clone and run 'grunt test' if you want to fiddle with this.

Thanks

--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscribe <at> googlegroups.com.
To post to this group, send email to angular <at> googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Olivier Clément | 27 Jun 05:17 2013
Picon

Re: Unit Test Controller: Injected Service is empty or undefined

Hey there

Thanks for the reply

I just tried spyOn: Looks like that was the answer (or part of it; I'm not sure due to my lack of unit testing experience)

It doesn't throw an error on the spyOn method now.
If I do 'expect obj.method toHaveBeenCalled', it fails on that. But that might be because of the fact that I call that method in the body of the controller directly? -> I mean, maybe the method hasn't been called when the test execute?

 Also, any idea why everywhere I see the use of 'jasmine.spyOn', while only 'spyOn' works for me?

Thank a lot, it's definitely a good step in the right direction though;



On Wednesday, June 26, 2013 10:50:24 PM UTC-4, Ricardo Bin wrote:
Hi,

I just have a quick look to your code... Did you try to use spyOn instead of jasmine.spyOn ?

Em quarta-feira, 26 de junho de 2013 20h50min37s UTC-3, Olivier Clément escreveu:
Hey Folks,

So I am at the early stages of an Proof of Concept I'm working on, and trying to get unit testing right, I want to test a very simple controller that relies on a service I wrote.

Right now, all it does is the controller calls a method on the service, that returns an array to the ctrl.

I can test whatever is in the scope of the controller, which is fine. But I cannot seem to access anything related to the service I (try to) inject in there. It appears empty, as if it were an empty object.

I inlined comments to show what happens.

Feel free to clone and run 'grunt test' if you want to fiddle with this.

Thanks

--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscribe <at> googlegroups.com.
To post to this group, send email to angular <at> googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Gmane