【问题标题】:UI-SREF not working inside _layout.cshtmlUI-SREF 在 _layout.cshtml 中不起作用
【发布时间】:2017-09-15 08:17:39
【问题描述】:

我正在构建一个只有两个状态的 Web 应用程序,即。结果和队列。当我的 Result 状态处于活动状态时,我希望它也以类似的方式突出显示为我的 Queue 状态。我将 UI-SREF 放在我的 _layout.cshtml 中。由于某种原因,它无法正常工作。

我在我的状态页面中尝试了 ui-sref 它正在工作。

下面是我的 _layout.cshtml

    **_layout.cshtml**

    <div class="menuBar">

    <span class="applicationName">Results Review Application</span>

    <span  ui-sref="Queue" ui-sref-active-eq="activeState">Queue</span>
    <span  ui-sref="Result" ui-sref-active-eq="activeState">Result</span>
</div>

下面是我的路由代码:

    (function () {
angular.module('resultReview')
.config(['$stateProvider','$urlRouterProvider', function ($stateProvider,$urlRouterProvider) {
    $stateProvider
    .state('Result', {
        url: '/Result',
        templateUrl: 'ResultReview/ResultPage'
    })
    .state('Queue', {
        url: '/Queue',
        templateUrl: 'ResultReview/ReviewTable'
    });
    $urlRouterProvider.otherwise('/Queue');
}]);

})()

我希望span元素的样式在状态改变时改变

下面是我的“activeState”类的css代码

   .activeState {
background-color:white;
text-decoration:underline;

}

感谢您提供这方面的任何帮助

谢谢!

【问题讨论】:

    标签: css angularjs asp.net-mvc angular-ui-router


    【解决方案1】:

    我为解决该问题而遵循的解决方案是在我的 _layout.cshtml 的 html 标记中包含 ngApp 指令。

    这样做解决了我的问题。

    希望它能帮助像我这样的人。

    【讨论】:

      猜你喜欢
      • 2015-06-21
      • 1970-01-01
      • 2015-02-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-05-26
      • 1970-01-01
      • 2015-01-23
      相关资源
      最近更新 更多