我需要在角度j的另一个控制器中调用函数.如果有可能,请提前帮助我
代码:
app.controller('One', ['$scope',
function($scope) {
$scope.parentmethod = function() {
// task
}
}
]);
app.controller('two', ['$scope',
function($scope) {
$scope.childmethod = function() {
// Here i want to call parentmethod of One controller
}
}
]);
Run Code Online (Sandbox Code Playgroud) 在这里,我正在绘制路线并使用 Leaflet Routing Machine Leaflet Routing Machine为路线分配停靠点
var control = L.Routing.control(L.extend(window.lrmConfig, {
waypoints: [array object of stops],
geocoder: L.Control.Geocoder.nominatim(),
routeWhileDragging: true,
reverseWaypoints: true,
showAlternatives: true,
altLineOptions: {
styles: [
{color: 'black', opacity: 0.15, weight: 9},
{color: 'white', opacity: 0.8, weight: 6},
{color: 'blue', opacity: 0.5, weight: 2}
]
}
})).addTo(map);
Run Code Online (Sandbox Code Playgroud)
在航点对象数组中,我绑定了自定义标记,例如:
L.marker([item.latLng.lat, item.latLng.lng], {icon: stopIcon}).addTo(map).bindPopup(item.name);
Run Code Online (Sandbox Code Playgroud)
但是我得到了 2 个标记,1 是默认值,第二是我的自定义图标。您可以在我的屏幕截图中看到默认(蓝色标记)和自定义图标(停止图像)
所以我想用我的自定义替换默认(蓝色标记)并删除默认标记。谢谢。