0

我只是想測試打開左模與下面的庫使用ngAside的幫助:
使用ngAside打開一個簡單的左菜單莫代爾

https://github.com/dbtek/angular-aside

我覺得我做的是正確的,還是可以找到一個JS錯誤。有人可以幫忙嗎?

的index.html:

<html> 

<head> 
    <!-- Required CSS --> 
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/css/bootstrap.min.css"/> 
    <!-- Required Scripts --> 
    <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.8/angular.min.js"></script> 
    <script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/1.1.2/ui-bootstrap-tpls.min.js"></script> 
    <script src="../js/angular-aside.min.js"></script> 
</head> 

<body ng-app="myApp" ng-controller="myCtrl"> 
    <input type="text" ng-model="name"/> 
    {{name}} 

    <script> 
    //module declaration 
    var app = angular.module('myApp',['ui.bootstrap', 'ngAside']); 
    //Controller declaration 
    app.controller('myCtrl',function($scope){ 

     $scope.name = "Peter"; 

     var asideInstance = $aside.open({ 
      templateUrl: 'aside.html', 
      controller: 'AsideCtrl', 
      placement: 'left', 
      size: 'lg' 
     }); 

    }); 

    app.controller('AsideCtrl',function($scope){ 


    }); 
    </script> 
</body> 

</html> 

aside.html

Hello World! 

ERROR:

enter image description here

回答

2

要使用aside服務,你必須注入像這樣(請注意在構造函數中的$一邊注射):

app.controller('myCtrl',function($scope, $aside){ 
... 
    }); 
相關問題