0

AngularJs我正在使用ngAria改进可访问性。我正在使用ui-sref它来转换我的代码

 <ul style="font-size: 18px">
     <li>
        <a ui-sref="scheduleallocation" >Department Admin DayTimeLocation</a>
     </li>
     <li>
        <a ui-sref="activityoffering" >ActivityOffering List</a>
     </li>
     <li>
         <a ui-sref="scheduleassignment" >Schedule Assignment</a>
     </li>
 </ul>

对此

<ul style="font-size: 18px">
   <li>
       <a ui-sref="scheduleallocation" href="#/scheduleallocation">Department Admin DayTimeLocation</a>
   </li>
   <li>
       <a ui-sref="activityoffering" href="#/activityoffering">ActivityOffering List</a>
   </li>
   <li>
      <a ui-sref="scheduleassignment" href="#/scheduleassignment//">Schedule Assignment</a>
    </li>
 </ul>

它在href中添加了#,这就是为什么在可访问性中出现以下错误。如何解决它?

在此处输入图像描述

4

1 回答 1

0

You could switch to using html5mode with angularJs's $location service.

When you have html5Mode enabled, the # character will no longer be used in your urls. Using the # symbol is easier, because it requires no server side configuration. Html5Mode uses the browsers history API, and does not require the # character - the url looks much nicer, but it also requires server side rewrites.

Using html5mode will change your link from href="#/scheduleallocation" to href="/scheduleallocation"

See https://docs.angularjs.org/guide/$location for more info on using html5mode.

于 2018-07-30T11:57:08.070 回答