Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 解释这个锚定标记语法_Html_Ionic Framework_Anchor - Fatal编程技术网

Html 解释这个锚定标记语法

Html 解释这个锚定标记语法,html,ionic-framework,anchor,Html,Ionic Framework,Anchor,在爱奥尼亚离子导航视图文档中,有一个我以前从未见过的锚定标记语法。我想知道这种将hashtag与正斜杠相结合的语法是否是Ionic独有的,或者是什么 <script id="home" type="text/ng-template"> <!-- The title of the ion-view will be shown on the navbar --> <ion-view view-title="Home"> <ion-conten

在爱奥尼亚离子导航视图文档中,有一个我以前从未见过的锚定标记语法。我想知道这种将hashtag与正斜杠相结合的语法是否是Ionic独有的,或者是什么

<script id="home" type="text/ng-template">
  <!-- The title of the ion-view will be shown on the navbar -->
  <ion-view view-title="Home">
    <ion-content ng-controller="HomeCtrl">
      <!-- The content of the page -->
      ****<a href="#/music">****Go to music page!</a>
    </ion-content>
  </ion-view>
</script>

****

这是一种允许在SPA中导航的方法,不需要刷新页面,还允许使用常规浏览器书签。

url中的#之后的所有内容都称为“片段标识符”,告诉浏览器在页面上的何处引导用户注意

在传统的web页面中,您可能习惯于看到片段标识符,它们只是一个单词,但几乎任何东西(当然包括/)都是片段标识符中的有效字符

所以我不会说这是不同的语法——你仍然有一个带有片段标识符的url

在SPA世界中,您希望能够在不实际导致新页面加载的情况下处理一系列“虚拟页面”,将看起来像路径的内容放在片段ID中是有意义的。通常,浏览器端的脚本对片段ID作出反应,通过AJAX加载适当的资源