TomNeyland / angular-dc

AngularJS directives for dc.js
http://tomneyland.github.io/angular-dc/
MIT License
112 stars 58 forks source link

Getting TypeError: _ is not a function in unwatch function #28

Closed patb23 closed 9 years ago

patb23 commented 9 years ago

First, Thanks for the cool Dashboard.

I am trying to use this library in a MEAN stack- I am new to all Web Stacks. I am trying to run the pie-chart example in MEAN but am getting the above error in the following line

                        var options = _(iAttrs.$attr).keys().filter(function(s) { // Throws error before going into the function.
                            return s.substring(0, 2) === 'dc' && s !== 'dcChart' && s !== 'dcChartGroup';
                        })

This works perfectly fine as an angular app. When I debug through Firebug, I see that the $attr has values.

The dependencies are

        "bootstrap": "~3",
        "angular": "~1.2",
        "angular-resource": "~1.2",
        "angular-mocks": "~1.2",
        "angular-cookies": "~1.2",
        "angular-animate": "~1.2",
        "angular-touch": "~1.2",
        "angular-sanitize": "~1.2",
        "angular-bootstrap": "~0.11.2",
        "angular-ui-utils": "~0.1.1",
        "angular-ui-router": "~0.2.11",
    "nvd3": "~1.1.15-beta",
    "d3": "~3.5.1",
    "angular-dc": "~0.0.4",
    "crossfilter": "~1.3.0"
  },
  "resolutions": {
    "d3": "~3.5.1"
  }

Please let me know, if any additional details are required. Thanks

firebug error

TomNeyland commented 9 years ago

@patb23 The missing dependency is lodash/underscore, is it specific in the bower.json file, https://github.com/TomNeyland/angular-dc/blob/master/bower.json#L7

patb23 commented 9 years ago

I am using Yeoman generators for Angularjs and MeanJS. In angularjs (working version), the global variable '' is commented out. In the MeanJS (not-working) version, in config/config.js, the '' is defined 'require('lodash')' and if I comment this out,the application is not starting. Should I delete the Global variable? Thanks

"dependencies": {
    "bootstrap": "~3",
    "angular": "~1.2",
    "angular-resource": "~1.2",
    "angular-mocks": "~1.2",
    "angular-cookies": "~1.2",
    "angular-animate": "~1.2",
    "angular-touch": "~1.2",
    "angular-sanitize": "~1.2",
    "angular-bootstrap": "~0.11.2",
    "angular-ui-utils": "~0.1.1",
    "angular-ui-router": "~0.2.11",
    "nvd3": "~1.1.15-beta",
    "d3": "~3.5.1",
    "angular-dc": "~0.0.4",
    "crossfilter": "~1.3.0",
    "lodash":"~2.4.1",
    "angular-lodash":"~0.1.2"
  },
  "resolutions": {
    "d3": "~3.5.1"
  }

On Sat, Dec 13, 2014 at 4:33 PM, Tom Neyland notifications@github.com wrote:

@patb23 https://github.com/patb23 The missing dependency is lodash

— Reply to this email directly or view it on GitHub https://github.com/TomNeyland/angular-dc/issues/28#issuecomment-66892411 .

patb23 commented 9 years ago

Please treat this issue as closed. I learnt it hardway that I included the angul;ar-dc before including the lodash.js in the env/all.js. When I changed the order, I got this working.

Thanks