为什么我不能在角度js中使用$旁边?

时间:2016-10-25 06:40:48

标签: angularjs

我有一个关于角js的问题。 我尝试打开对话框使用$旁边但我得到注入错误我尝试此代码我尝试在安装bower install angular-aside后使用ngAsige,但我得到错误像Failed to instantiate module IndexHome due to:如果我的代码中的任何错误请告诉我它在哪里,安装后angular-aside是我必须包含在我的.html文件中的任何.js文件?

var Myapp = angular.module('IndexHome', ['ngRoute','ui.bootstrap', 'ngAside']);
Myapp.controller('home', function ($scope, $window, $http,$aside) {

var ServiceForm = $aside({
        scope: $scope,
        templateUrl: '/tpl/index/home/popup.html',
        show: false,
        placement: 'left',
        backdrop: false,
        animation: 'am-slide-left'
  });

  $scope.Bookservice=function(item)
  {
            ServiceForm.show();
  }

});

我还包括角度之后的.js和.css文件 enter image description here

2 个答案:

答案 0 :(得分:2)

与任何其他角度模块/依赖项一样,为了能够使用Angular Aside,请确保包含angular-aside.js(以及 angular-aside.css )并注入它在哪里你想用它:

angular.module('myApp', ['ui.bootstrap', 'ngAside']);

angular.module('myApp')
  .controller('MyController', function($scope, $aside) { });

查看Angular Aside RepoPlunker example

答案 1 :(得分:1)

您需要将angular-aside.jsangular-aside.css(或其缩小版本)包含在index.html中。