$route
ディレクティブ機能のアクセス方法はありますか?
私は基本的にしたいことは、現在のtemplateUrl
を知っている、と言う:
app.directive("scrollable", function ($document) {
return {
restrict: 'A',
link: function (scope, element, attrs) {
$document.bind('scroll', function (evt) {
console.log($route.current.templateUrl); // $route is undefined!
});
}
};
});
がP.S.私は、私はあなたの問題を解決するための答え上記一方のディレクティブ
app.directive("scrollable", function ($document,$route) {
あなたはディレクティブに渡そうとしましたか? –
あなたはどのルータを使用していますか?デフォルトまたはui-router? –
'' app.directive( "スクロール可能"、['$ document'、 '$ route'、function($ document、$ route){...}]); ' –