Bootstrap UI未加载Angular

时间:2015-03-11 21:40:55

标签: angularjs dependency-injection twitter-bootstrap-3 angular-ui-bootstrap

我正在尝试使用带有Bootstrap UI的datepicker。我已经注册了bootstrap javascript和bootstrap CSS(使用gulp),但是我收到以下错误:

  

错误:[$ injector:nomod]模块'ui-bootstrap'不可用!您   要么错误拼写模块名称,要么忘记加载它。如果注册   模块确保您将依赖项指定为第二个   参数

的index.html

    <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.14/angular.js"></script>

 <script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.2.13/angular-ui-router.js"></script>

//Bootstrap JS here
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.12.1/ui-bootstrap.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.12.1/ui-bootstrap-tpls.min.js"></script>

//Other JS here
    <script src="https://cdnjs.cloudflare.com/ajax/libs/angular-strap/2.2.0/angular-strap.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/angular-strap/2.2.0/angular-strap.tpl.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.14/angular-messages.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.14/angular-resource.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.14/angular-route.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.14/angular-cookies.js"></script>

注射:

angular.module('formApp', ['ngAnimate', 'ui.router', 'ui-bootstrap'])

// configuring our routes 
// =============================================================================
.config(function($stateProvider, $urlRouterProvider) {

    $stateProvider

        // route to show our basic form (/form)
        .state('form', {
            url: '/',
            templateUrl: 'views/home.html',
            controller: 'formController'
        })
        // nested states 
        // each of these sections will have their own view
        // url will be nested (/form/profile)
       .state('form.profile', {
            url: '/',
            templateUrl: 'views/form-date.html'
        })

        // url will be /form/interests
        .state('form.interests', {
            url: '/',
            templateUrl: 'views/form-interests.html'
        })

        // url will be /form/payment
        .state('form.payment', {
            url: '/',
            templateUrl: 'views/form-payment.html'
        });

    // catch all route
    // send users to the form page 
    $urlRouterProvider.otherwise('/');
})

1 个答案:

答案 0 :(得分:1)

您只需要tmpl版本,因为它包含完整的js,但您的问题是您需要

'ui.bootstrap' not 'ui-bootstrap'