小编Sha*_*h K的帖子

angularJS中的状态提供者和路由提供者

下面是我的app.js文件

angular
  .module('repoApp', [
    'ngAnimate',
    'ngAria',
    'ngCookies',
    'ngMessages',
    'ngResource',
    'ngRoute',
    'ngSanitize',
    'ngTouch',
    'ui.bootstrap',
    'ui.router'
  ])
  .config(function ($routeProvider) {
    $routeProvider
      .when('/', {
        templateUrl: 'views/main.html',
        controller: 'MainCtrl'
      })
      .when('/about', {
        templateUrl: 'views/about.html',
        controller: 'AboutCtrl'
      })
      .when('/login', {
        templateUrl: 'views/loginPage.html',
        controller: 'loginCtrl'
      })
      .otherwise({
        redirectTo: '/'
      });
  });
angular
  .module('loginState',['ui.router']);
Run Code Online (Sandbox Code Playgroud)

以下是我的州档案

angular
  .module('repoApp')
  .config(function ($stateProvider) {

      $stateProvider.state('home1', {
        url:'/home1',
        templateUrl: 'views/modals/test.html'
      })
      .state('secondState',{
        url:'/secondState',
        templateUrl: 'views/modals/secondStateTest.html'
      });
  });
Run Code Online (Sandbox Code Playgroud)

问题是,使用我的html导航到登录页面.

<ul class="nav navbar-nav">
              <li class="active"><a href="#/">Home</a></li>
              <li><a ng-href="#/about">About</a></li>
              <li><a ng-href="#/">Contact</a></li>
              <li class="loginShift"><a ng-href="#/login">Login</a></li>
            </ul> …
Run Code Online (Sandbox Code Playgroud)

javascript angularjs angular-routing

16
推荐指数
1
解决办法
10万
查看次数

Plotly:如何处理重叠的颜色条和图例?

我有一个简单的图表,我正在使用 Plotly Express 库来绘制它。图像如下,有两个图例重叠“Rank”和“Genre”。

px.scatter_ternary(data_frame = data, a='Length.', b='Beats.Per.Minute', c='Popularity',
               color = 'Rank',
               symbol = 'Genre',
               labels = {'Length.': 'Len', 'Beats.Per.Minute':'Beats'},
               color_continuous_midpoint = 15,
               symbol_sequence = ['circle-open-dot', 'cross-open','triangle-ne'])
Run Code Online (Sandbox Code Playgroud)

可以采取什么措施来避免重叠?

python plot plotly

10
推荐指数
2
解决办法
8435
查看次数

angularJS中的模态服务

以下是我的控制器

angular.module('repoApp')
  .controller('loginCtrl', function ($scope,$modal,$state) {
    $scope.awesomeThings = [
      'HTML5 Boilerplate',
      'AngularJS',
      'Karma'
    ];

    $modal.open({     
      templateURL: 'views/modals/test.html',      
    });  
  });
Run Code Online (Sandbox Code Playgroud)

以下是我的模板:

<div class="modal-header">
            <h3 class="modal-title">I'm a modal!</h3>
        </div>
Run Code Online (Sandbox Code Playgroud)

错误是我得到的:

Error: One of template or templateUrl options is required.
    at Object.$modalProvider.$get.$modal.open (http://localhost:9000/bower_components/angular-bootstrap/ui-bootstrap-tpls.js:2353:21)
    at new <anonymous> (http://localhost:9000/scripts/controllers/login/loginCtrl.js:18:12)
    at invoke (http://localhost:9000/bower_components/angular/angular.js:4203:17)
    at Object.instantiate (http://localhost:9000/bower_components/angular/angular.js:4211:27)
    at http://localhost:9000/bower_components/angular/angular.js:8501:28
    at link (http://localhost:9000/bower_components/angular-route/angular-route.js:975:26)
    at invokeLinkFn (http://localhost:9000/bower_components/angular/angular.js:8258:9)
    at nodeLinkFn (http://localhost:9000/bower_components/angular/angular.js:7768:11)
    at compositeLinkFn (http://localhost:9000/bower_components/angular/angular.js:7117:13)
    at publicLinkFn (http://localhost:9000/bower_components/angular/angular.js:6996:30) <div ng-view="" class="ng-scope">
Run Code Online (Sandbox Code Playgroud)

这段代码没有打开模板,但是当我使用'template'option并在那里插入模板标记时,它会显示出来.此模板URL未被触发.我已配置我的gruntfile但我不确定是否还要在那里进行任何更改.是否需要在index.html中包含任何lib?

templates modal-dialog angularjs angular-ui-bootstrap

3
推荐指数
1
解决办法
2686
查看次数