Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > BOOK: Professional AngularJS
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #11 (permalink)  
Old January 4th, 2016, 04:48 AM
pip pip is offline
Registered User
Points: 3, Level: 1
Points: 3, Level: 1 Points: 3, Level: 1 Points: 3, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2016
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Scope Variables in watchlist controller not being created

Quote:
Originally Posted by dougal83 View Post
I figured it out... Yeoman automatically adds "controllerAs: 'watchlist'" to the route causing a conflict with the keyword. We wont be using the controllerAs alias so you can just comment it out like below(or just change either variable name):

PHP Code:
      .when('/watchlist/:listId', {
        
templateUrl'views/watchlist.html',
        
controller'WatchlistCtrl'//,
        //controllerAs: 'watchlist'
      
}) 
EDIT: app/scripts/app.js

Voila! Working code and no more head scratching.
Hi, I've had the same problem, but this solution above didn't fix it for me. I noticed that none of the scope variables created in the watchlist controller (watchlist.js) are being created in the scope. It appears only scope variables created in the main controller are appearing. I've been banging my head against the wall on this for days now. Please help
Reply With Quote
  #12 (permalink)  
Old January 4th, 2016, 05:23 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

Obviously would need to see your code.. but I'm tight on time. First off try and solve it yourself... I have posted a working example(variation using ui-bootstrap) https://github.com/dougal83/stock-dog

See how the code varies compared to relevant parts of your project. If you exhaust your search, post your project online (github?) along with any error messages, so someone else can replicate and see if they can see what is wrong allowing for free time.
Reply With Quote
  #13 (permalink)  
Old March 28th, 2017, 06:12 PM
Registered User
Points: 3, Level: 1
Points: 3, Level: 1 Points: 3, Level: 1 Points: 3, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2017
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Red face

Thanks, this was hard for me to find out.

Moreover I had introduced another bug: I forgot to isolate the scope of the stkWatchlistPanel directive so $scope.watchlist got overwritten by it:

PHP Code:
  .directive('stkWatchlistPanel',
  function (
$location$modal$routeParamsWatchlistService) {
    return {
      
templateUrl'views/templates/watchlist-panel.html',
      
restrict'E',
      
scope: {},        // <<== isolate scope
      
link: function ($scope) {
        
// [2] initialize variables
        
$scope.watchlist = {}; 
Maybe this helps someone some day

Last edited by codekraft; March 28th, 2017 at 06:14 PM. Reason: change [CODE] to [PHP] for better syntax highlighting
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Modal Popup Extender - not modal? jenbuh ASP.NET 3.5 Professionals 5 July 27th, 2009 07:04 PM
MsgBox not Modal? tknnguyen Visual Basic 2008 Professionals 3 February 18th, 2009 10:55 AM
Modal Window... babloo81 Javascript 2 February 21st, 2005 06:08 AM
modal window pablens Classic ASP Professional 3 December 28th, 2004 04:28 PM
Modal Forms aspadda Excel VBA 2 November 26th, 2003 10:11 AM



All times are GMT -4. The time now is 09:57 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.