$ location使用d3.js在AngularJS中不起作用

cli*_*oid 9 javascript d3.js angularjs

这是我第一次面对这个问题而无法弄清楚原因.我正在使用d3来创建冰柱图表.有一个点击事件正在触发并调用changePath().我看到控制台日志,这意味着我有权访问$ location.path但是当我尝试设置它时没有任何事情发生...不是新页面而不是错误页面什么都没有...如果我不通过角度改变路径我的路由器不会保持我正在寻找的范围...任何线索?

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 d.x; })
              .attr("x", function(d) { return d.y; })
              .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);
         });
     }
}

Mar*_*dig 2

强迫症不会让我对这个问题“开放”。所以,正如格罗纳指出的那样......嗨,我想你会在这个问题中找到你的问题的答案:AngularJS $location not moving the path

另外,还有一点价值广告。查看这些包装 d3 的指令http://www.fullscale.co/dangle/