 |
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
|
|
|
|

May 31st, 2015, 04:06 AM
|
|
Registered User
|
|
Join Date: May 2015
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

June 10th, 2015, 12:31 PM
|
|
Authorized User
|
|
Join Date: Jun 2005
Posts: 27
Thanks: 3
Thanked 0 Times in 0 Posts
|
|
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
|
|

August 18th, 2015, 11:54 AM
|
|
Registered User
|
|
Join Date: Aug 2015
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
});
|
|

August 19th, 2015, 07:16 PM
|
|
Authorized User
|
|
Join Date: Jul 2015
Posts: 18
Thanks: 0
Thanked 2 Times in 2 Posts
|
|
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
...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?
|
|

August 21st, 2015, 07:54 AM
|
|
Registered User
|
|
Join Date: Aug 2015
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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..
|
|

August 21st, 2015, 08:57 AM
|
|
Authorized User
|
|
Join Date: Jun 2005
Posts: 27
Thanks: 3
Thanked 0 Times in 0 Posts
|
|
I have been using Firefox. That is probably the issue if it was for you. Thanks for the info.
__________________
Cullan crothers
|
|

August 22nd, 2015, 07:16 AM
|
|
Authorized User
|
|
Join Date: Jul 2015
Posts: 18
Thanks: 0
Thanked 2 Times in 2 Posts
|
|
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.
|
|

August 22nd, 2015, 10:06 PM
|
|
Authorized User
|
|
Join Date: Mar 2015
Posts: 34
Thanks: 3
Thanked 2 Times in 2 Posts
|
|
Quote:
Originally Posted by dougal83
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?
|
|

August 24th, 2015, 06:25 AM
|
|
Authorized User
|
|
Join Date: Jul 2015
Posts: 18
Thanks: 0
Thanked 2 Times in 2 Posts
|
|
Quote:
Originally Posted by RacerBoy
So your thinking Chrome works better for this?
|
Yes. I think I'd go as far as knowing it works. 
|
|

August 27th, 2015, 10:05 AM
|
|
Authorized User
|
|
Join Date: Mar 2015
Posts: 34
Thanks: 3
Thanked 2 Times in 2 Posts
|
|
Need to try. Will let you know how it works.
|
|
 |
|