PatrickJS / NG6-starter

:ng: An AngularJS Starter repo for AngularJS + ES6 + Webpack
https://angularclass.github.io/NG6-starter
Apache License 2.0
1.91k stars 1.35k forks source link

cannot use angular-carousel #182

Closed xyuka closed 7 years ago

xyuka commented 7 years ago

I try to import angular-carousel and include in the module of app.js. But it show error

Uncaught Error: [$injector:modulerr] Failed to instantiate module app due to:(…)  angular.js:68
Error: [$injector:modulerr] Failed to instantiate module {} due to:
Error: [ng:areq] Argument 'module' is not a function, got Object
http://errors.angularjs.org/1.5.8/ng/areq?p0=module&p1=not%20a%20function%2C%20got%20Object

here is my app.js

import angular from 'angular';
import ngInfiniteScroll from 'ng-infinite-scroll';
import ngAnimate from 'angular-animate';
import ngCookies from 'angular-cookies';
import ngAria from 'angular-aria';
import ngMaterial from 'angular-material';
import ngSanitize from 'angular-sanitize';
import ngScroll from 'angular-scroll';
import ngLoading from 'angular-loading-bar';
import ngTranslate from 'angular-translate';
// import ngTranslateLoaderPartial from 'angular-translate-loader-partial';
import ngTranslateLoaderStaticFiles from 'angular-translate-loader-static-files';
import $ from 'jquery';
import jQuery from 'jquery';
import uiRouter from 'angular-ui-router';
import Common from './common/common';
import Components from './components/components';
import AppComponent from './app.component';
import 'angular-timer';
import 'normalize.css';
import appConfig from './app.config';
import appRun from './app.run';
import translate from './app.translate';
import ngTouch from 'angular-touch';
import ngCarousel from 'angular-carousel';

window.$ = $;
window.jQuery = jQuery;

angular.module('app', [
    uiRouter,
    Common,
    Components,
    ngInfiniteScroll,
    ngAnimate,
    ngCookies,
    ngAria,
    ngMaterial,
    ngSanitize,
    ngScroll,
    ngLoading,
    ngTranslate,
    ngTouch,
    ngCarousel,
    // ngTranslateLoaderPartial,
    ngTranslateLoaderStaticFiles,
    'pascalprecht.translate',
    'timer',
  ])

  .config(appConfig)

  .config(translate)

  .config(($locationProvider) => {
    "ngInject";
    // @see: https://github.com/angular-ui/ui-router/wiki/Frequently-Asked-Questions
    // #how-to-configure-your-server-to-work-with-html5mode
    $locationProvider.html5Mode(true).hashPrefix('!');
  })

  .run(appRun)

  .component('app', AppComponent);

Does anybody try or meet this issue?

Thanks

tucq88 commented 7 years ago

Get similar problem when try to import designmodo-flat-ui . It seems like our webpack configuration is not correct. I'm still working on this.

fesor commented 7 years ago

Looks like you need to use 'angular-carousel' instead of ngCarousel since this module doesn't have proper exports.