AngularJS UI-router How to load a state view into another nested view of a top level state?

后端 未结 2 1073
醉酒成梦
醉酒成梦 2020-12-22 03:12

https://plnkr.co/edit/XnDUIqfVuBS2Hr2N1ooy?p=preview

I have a top level state called container which holds the named views dashboard

2条回答
  •  我在风中等你
    2020-12-22 04:16

    Still waiting on more answers, but I got this working so far by using a tickers.component inside of the dashboard-template.html

    https://plnkr.co/edit/6dLIk1vq6M1Dsgy8Y4Zk?p=preview

    Dashbaord state

    tickers.component('tickersModule', {
      templateUrl: 'tickers-template.html',
      controller: function($scope, $state) {
        console.log('TICKERS component');
        $scope.tickers = [
          { id: 1, ticker: 'AAPL' },
          { id: 2, ticker: 'GOOG' },
          { id: 3, ticker: 'TWTR' }
        ];
    
        $scope.clickTicker = function(ticker) {
          console.log(' Ticker clicked!', $state)
          $state.go('tags', { ticker: ticker });
        }
      }
    });
    

提交回复
热议问题