R tget | 19 Aug 21:21 2014
Picon

Shopping cart with checkout in angular JS

Hi im building a shopping cart now on checkout im using external payment modules. so its get redirected to another site for example paypal and then come back for a thank you page.

but if a user selects a payment method and goes back, al the angular data is gone, cart is empty etc. what is the best way to handle this?

--
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/d/optout.
Migo | 19 Aug 19:58 2014
Picon

One more service resource factory question

Using a MEAN stack (fairly new to all of these) please pardon me if I'm way off ...

In mongo I have a collection of People

People have children so People have a single 'ParentId' property

{
   _id: ObjectId,
   ShortId: 1
   FirstName: 'Joe',
   LastName: 'Bob'
   ParentId: null
},
{
   _id: ObjectId,
   ShortId: 2
   FirstName: 'Jim',
   LastName: 'Bob'
   ParentId: 1
}
,
{
   _id: ObjectId,
   ShortId: 3
   FirstName: 'Billy',
   LastName: 'Bob'
   ParentId: 1
}

So I'm using Angular resource (angular-resource) for calling  "People" either a list of or single people

angular.module('app').factory('PeopleService',function($resource){
    var PeopleResource = $resource('/api/people/:_id', {_id:" <at> id"}, {
        update: {method:'PUT', isArray: false}
    });

    return PeopleResource;

});


So now I want to select all 'children' of a parent....this is not another resource correct? so it is a service?

angular.module('app').service('PeopleService', function($http, $q){
   this.getChildren = function(parentId){
      var deferred = $q.defer();
      deferred.resolve($http.get("/api/people/" + parentId + "/children"));
   }
})

should I just bail on the 'angular-resource' and just make it all a service?

It seems like using the resource i will end up with a 'resource' (meaning a new file) for every call to my api when I can just build a 'people' service and add all of my api calls there...

--
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/d/optout.
Ben | 19 Aug 16:02 2014
Picon

Spying on jQuery method inside directive fails

Hi guys

I'm facing some weird behaviour when trying to mock a jQuery method (scrollTop) used in an angular directive.

I'm setting the spy like this:
spyOn($.fn, 'scrollTop').and.returnValue('100');

The test looks like this:
it('...', function() {
        spyOn($.fn, 'scrollTop').and.returnValue('100');
        // $('').scrollTop() returns 100 here!
        compiledElement = $compile(tpl)(scope);
        expect(jQuery.fn.scrollTop).toHaveBeenCalled();
});

When I call the scrollTop inside the test, it works fine as commented in the snippet above. But when my directive in test calls scrollTop, it seems to somehow circumventing the spy.

Do you have any idea what is happening here?

Any pointers are appreciated! :)
Ben

--
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/d/optout.
PowerGoldKIng | 19 Aug 13:13 2014
Picon

Angular Animation plugin Details.

Hello Friends,

      Need to more information about latest angularjs Animation plugin 
feature or ther default animation feature could you share your news or 
idea....

uday bhaskar | 19 Aug 12:33 2014
Picon

Template rendering failure

I have a weird situation.  I am working on angular app where template rendering is failing, but other functions are working fine.  The data binding is not working at all and {{ }} are not rendered with the actual data.  What might be the issue?

--
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/d/optout.
Paolo Pantaleo | 19 Aug 09:58 2014
Picon

Updating model when selected item is deleted

Hello,

In this example I have a simple select

<select ng-model="myColor" ng-options="color.name for color in colors"> <option value="">-- choose color --</option> </select>

With three colors and a button to delete the last one

<button ng-click="delRed()">Delete red</button><br/>

JS code looks like that

angular.module('selectExample', []) .controller('ExampleController', ['$scope', function($scope) { $scope.colors = [ {name:'black'}, {name:'white'}, {name:'red'}, ]; $scope.myColor = $scope.colors[2]; // red $scope.delRed = function(){ $scope.colors.length = 2; } }]);

When red is selected and clicking on "Delete red " the -- choose color -- option is selected, but the model {{myColor}} is

{"name":"red"}

how can I set it to null (or empty string or any "empty" value) in case red was selected and is deleted in order to have it coherent with value?


This is a simplified version of the example in AngualrJS documentation, and in that example there is the same issue. Once the item doesn't exist I would expect the model to reflect that. Is this a limitation of AngularJS or am I missing something?

(Question already posted on http://stackoverflow.com/questions/25367105/updating-model-when-selected-item-is-deleted)


Regards
Paolo

--
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/d/optout.
Karthik Ram | 19 Aug 09:35 2014
Picon

can Protractor can be used to perform E-E testing other than AngularJs

I'm Doing some R&D on finding a java script framework to perform E-E testing, in that process i have come across "Protractor".My question is can "Protractor " be used on applications which are not developed using Angular Js??

 if its not possible,kindly suggest me suitable framework


Thankyou

--
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/d/optout.
Darin Hensley | 19 Aug 06:43 2014
Picon

Restangular- Reset addResponseInterceptor() to default

I have this in my angular.module('main', []).config():

RestangularProvider.setBaseUrl("" + API_BASE_URI + "1.0/loadbalancers");
 
return RestangularProvider.addResponseInterceptor(function(data, operation) {
   
switch (operation) {
     
case 'get':
         
return data.load_balancer_data;
     
case 'post':
       
return data.event_id;
     
default:
       
return data;
   
}
 
});


In a service, I am trying to reset the addResponseInterceptor() back to default behavior:

angular.module("main.loadbalancer").factory("StatusTrackerRestangular", function(Restangular) {
   
return Restangular.withConfig(function(RestangularConfigurer) {
       
RestangularConfigurer.addResponseInterceptor(function(data){
           
return data;
       
});
   
});
});


But not having success. How can I get addResponseInterceptor back to default?



--
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/d/optout.
Nasir Mansoor Usmani | 19 Aug 02:31 2014
Picon

AngularJS - select with zero(0) value

I want to filter records using text input and select input as show in example http://jsfiddle.net/nmusmani/gwnfkxmc/5/

Select options are:

`[ {StatusID: 0, StatusDesc: "New"}, {StatusID: 10, StatusDesc: "Enabled"}, {StatusID: 30, StatusDesc: "InProgess"}, {StatusID: 70, StatusDesc: "Done"} ];`

In order to display all values I have added option "all" with value ""

<select id="StatusID" name="statusID" ng-model="search.StatusID" ng-options="Status.StatusID as Status.StatusDesc for Status in StatusList"> <option value="">All</option> </select>

Problem is that on selecting NEW with value 0 it display all values while selecting ALL it displays nothing. Whereas, I want to show all record when ALL is selected and records with New status only when NEW is selected.  

--
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/d/optout.
leif hanack | 19 Aug 01:33 2014
Picon

How to open async calls triggered by a user in a new tab instead of a new window

Hi there, 

recently I had troubles to open a new tab instead of a new window when a user triggered an async action which should generate a PDF. 
The trick was to remember the reference to the new window and change the location of that window when the asynchron call completes.

Here you can find a running example

If you have any questions or suggestions please let me know.
I hope it will help, regards, Leif

--
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/d/optout.
Cody Scott | 18 Aug 22:27 2014
Picon

Updating two lists after ui-sortable drag and drop event.

I'm using angular-ui-sortable to re-order items in a list. But I want to group items (modules) by bundle, which is just a collection of modules.

In the demo there is a 'Re-order Bundles/Re-order Modules" button to switch between the re-order the different lists.

My problem is that I can't keep the modules in each list in the same order.

I was running updateBundles() and updateModules() after the stop event, but the readme on the repo said to use callbacks since they are used in the DOM. 

I tried $watch and $watchCollection.

I would like to re-order the module list and see the module change location in the bundles list.


http://plnkr.co/edit/L88uWnwaDRgx6u48pgAn?p=preview

--
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/d/optout.

Gmane