$ location does not work in AngularJS using d3.js

This is the first time I encounter a problem and cannot understand why. I use d3 to create an icicle diagram . There is a click event that fires and calls changePath (). I see a console log, which means that I have access to $ location.path, but when I try to install it, nothing happens ... not a new page, not a page with an error nothing ... If I do not change the path via angular, my router will not support the area, which is what I'm looking for ... any hints?

  var parentCtrl = function ($ scope, $ location) {

 $ scope.makeBSC = function () {

         var changePath = function (el) {
           console.log ($ location.path ());
           $ location.path (el)
         }
         var width = 405,
             height = 420,
             color = d3.scale.category20c ();

         var vis = d3.select ("# bscChart"). append ("svg")
             .attr ("width", height)
             .attr ("height", width);

         var partition = d3.layout.partition ()
             .size ([width, height])
             .value (function (d) {return d.size;});

         var json = data;


         vis.data ([json]). selectAll ("rect")
           .data (partition.nodes)
             .enter (). append ("rect")
               .attr ("y", function (d) {return dx;})
               .attr ("x", function (d) {return dy;})
               .attr ("height", function (d) {return d.dx;})
               .attr ("width", function (d) {return d.dy;})
               .attr ("class", function (d) {
                 if (d.isSel) return "rectBlue"
                 return "rectGray"
               }). on ("click", function (d) {
                 changePath (d.goTo);
          });
      }
 }
+7
source share
1 answer

OCD will not let me leave this question open. So, as groner pointed out ... Hi, I think you will find the answer to your question in this question: Location of AngularJS $ does not change the path

In addition, a small value is ad. Check out these directives that wrap d3 http://www.fullscale.co/dangle/

+1
source

All Articles