Anchor Scroll, angularjsanchor
As the saying goes: Good memory is not as bad as a pen. This article takes notes on the angularjs module. First, we will start from anchor scroll. For details, see the following:
• $ AnchorScroll () is used to jump to the definition ID;
• The hash () method of the $ location object replaces the current url with the hash key;
• $ AnchorScroll () reads and redirects to the ID.
The following is a simple example. The output result is as follows:
Line 11 of source code index.html indicates the jump ID:
<!DOCTYPE html>
App. js
Var demoApp = angular. module ("app", []). controller ("MockController", function ($ scope, $ location, $ anchorScroll) {$ scope. numbers = {"Natural Number ":["","","","","","","","","","", "", ""], "prime number ":["", "", "," "]}; $ scope. jumper = function (key) {$ location. hash (key); $ anchorScroll ();}});
The above is the Anchor Scroll-related content of AngularJS modules compiled for you. I hope you will like it.