Wrox Programmer Forums
|
BOOK: Professional AngularJS
This is the forum to discuss the Wrox book Professional AngularJS by Valeri Karpov, Diego Netto; ISBN: 978-1-118-83207-3
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional AngularJS section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 31st, 2015, 04:06 AM
Registered User
 
Join Date: May 2015
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Some data retrieving issue

hi,

I faced some issue when I run stockDog app.

in side addStock-modal.html we select company's label using following directive

<input type="text"
class="form-control"
id="stock-symbol"
placeholder="Stock Symbol"
ng-model="newStock.company"
ng-options="company as company.label for company in companies"
bs-typeahead
required>

click save button which will call following function

$scope.addStock = function(){

$log.debug(" stocks length " + $scope.stocks.length);

$scope.watchlist.addStock(
{
listId:$routeParams.listId,
company:$scope.newStock.company,
shares: $scope.newStock.shares
}
);

addStockModal.hide();
$scope.newStock = {};
};


we pass company informaion like this $scope.newStock.company

it returns only company name

so when we try to access stock.company.symbol ,it is undefine

thanks

Wathsala
 
Old June 10th, 2015, 12:31 PM
Authorized User
 
Join Date: Jun 2005
Posts: 27
Thanks: 3
Thanked 0 Times in 0 Posts
Default I am having a similar problem on that same section

The Stock Symbol is not showing in the resulting table under the watchlist that I have added the stock to...the number of shares does show there, but not the stock symbol. I have entered a new thread and hope somebody may know the issue with this section of the book.
__________________
Cullan crothers
 
Old August 18th, 2015, 11:54 AM
Registered User
 
Join Date: Aug 2015
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The company field is being assigned string value instead of an object, my fix (in watchlist.js controller) was to find and assign an object to that field. See below in bold

Code:
           var c = _.find($scope.companies, function(company){
                return company.label == $scope.newStock.company;
            });

            $scope.watchlist.addStock({
                listId: $routeParams.listId,
                company: c,
                shares: $scope.newStock.shares
            });

Last edited by [email protected]; August 18th, 2015 at 01:21 PM.. Reason: typo
 
Old August 19th, 2015, 07:16 PM
Authorized User
Points: 130, Level: 2
Points: 130, Level: 2 Points: 130, Level: 2 Points: 130, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2015
Posts: 18
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Curious, I needed no such change for the code to work.

What version of AngularStrap are you using? Discovered issues have been down to changes in dependencies such as the following from another thread.

Quote:
Originally Posted by allegrojm View Post

...I also solved by using bs-options. I first installed the latest Angular-strap...

thanks
Are your books showing the same code as on Diego Netto's copy on github?
 
Old August 21st, 2015, 07:54 AM
Registered User
 
Join Date: Aug 2015
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I also experienced this similar issue. However, I think the problem is related to a browser specific issue. Using a different browser removed my problem. What browser are you using currently?
I originally used firefox when I've experienced the problem. However, using chrome with the same codebase, it worked correctly.


Based on my observation:
On firefox, the post request sends the company field as a string, so the company.symbol gets resolved as undefined.
While on chrome, the company field is sent as an object, which is the correct behavior.

I haven't studied why the post behavior is different on the browsers though.

Last edited by kdblitz; August 22nd, 2015 at 08:22 AM..
 
Old August 21st, 2015, 08:57 AM
Authorized User
 
Join Date: Jun 2005
Posts: 27
Thanks: 3
Thanked 0 Times in 0 Posts
Default

I have been using Firefox. That is probably the issue if it was for you. Thanks for the info.
__________________
Cullan crothers
 
Old August 22nd, 2015, 07:16 AM
Authorized User
Points: 130, Level: 2
Points: 130, Level: 2 Points: 130, Level: 2 Points: 130, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2015
Posts: 18
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Yeah, Chrome recommended in the book.

Interestingly my updated version of the code works on Firefox. Maybe later versions of the dependencies handle the compatibility issue with Firefox.
 
Old August 22nd, 2015, 10:06 PM
Authorized User
 
Join Date: Mar 2015
Posts: 34
Thanks: 3
Thanked 2 Times in 2 Posts
Default

Quote:
Originally Posted by dougal83 View Post
Yeah, Chrome recommended in the book.

Interestingly my updated version of the code works on Firefox. Maybe later versions of the dependencies handle the compatibility issue with Firefox.
So your thinking Chrome works better for this?
 
Old August 24th, 2015, 06:25 AM
Authorized User
Points: 130, Level: 2
Points: 130, Level: 2 Points: 130, Level: 2 Points: 130, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2015
Posts: 18
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Quote:
Originally Posted by RacerBoy View Post
So your thinking Chrome works better for this?
Yes. I think I'd go as far as knowing it works.
 
Old August 27th, 2015, 10:05 AM
Authorized User
 
Join Date: Mar 2015
Posts: 34
Thanks: 3
Thanked 2 Times in 2 Posts
Default

Need to try. Will let you know how it works.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Retrieving data from a Share drive Newbie19 VB.NET 2 June 26th, 2007 07:20 AM
Retrieving Data From Server x_ray Word VBA 0 June 12th, 2006 10:33 AM
Help! Retrieving data from a formview!?! FabRed VB Databases Basics 0 April 23rd, 2006 09:39 AM
retrieving data using id. mikeuk Beginning PHP 7 July 21st, 2004 05:48 AM
Retrieving data direct from dbase?? junemo MySQL 16 June 16th, 2004 02:08 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.