码迷,mamicode.com
首页 > 其他好文 > 详细

ui-router中的锚点问题(angular中的锚点问题)

时间:2016-12-16 09:58:01      阅读:351      评论:0      收藏:0      [点我收藏+]

标签:问题   api   ash   lex   set   outer   处理   ui-router   参数   

angular.module(‘anchorScrollExample‘, [])
.controller(‘ScrollController‘, [‘$scope‘, ‘$location‘, ‘$anchorScroll‘,
  function($scope, $location, $anchorScroll) {
    $scope.gotoBottom = function() {
      // set the location.hash to the id of
      // the element you wish to scroll to.
      $location.hash(‘bottom‘);

      // call $anchorScroll()
      $anchorScroll();
    };
  }]);


官网文档传送门:https://docs.angularjs.org/api/ng/service/$anchorScroll
综上,angular对锚点做了处理,使用时先用$location.hash(),指定位置,hash的参数就是锚点id,然后再使用$anchorScroll()移动到锚点;

ui-router中的锚点问题(angular中的锚点问题)

标签:问题   api   ash   lex   set   outer   处理   ui-router   参数   

原文地址:http://www.cnblogs.com/ftqh/p/6185626.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!