내가 처음으로이 문제에 직면했으며 이유를 알 수 없습니다. d3을 사용하여 icicle chart을 만듭니다. 발사하고 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); }); } }
안녕하세요,이 질문에 대한 답변을 찾으실 수있을 것입니다. [AngularJS $ location not the path change] (http://stackoverflow.com/questions/11784656/angularjs) -location-not-changing-the-path) – groner
아! 정말 고맙습니다! 적용을 시도했지만 구문이 잘못되었습니다. 매우 감사! 이 메시지를 응답으로 추가하여 올바른 것으로 표시 할 수 있습니까? – climboid