Using a 3rd party module in AngularJS app -
how can utilize angularjs module within application? https://github.com/bendrucker/angular-credit-cards
i placed 4 files in /src
directory directory on server. it's set this:
/src cvc.js expiration.js module.js number.js
then, in html have following:
<script src="http://example.com/content/js/angular.min.js"></script> <script src="http://example.com/content/js/angular-credit-cards/module.js"></script>
in main javascript file, declare module credit-cards
dependancy:
var checkout = angular.module('checkout', ['credit-cards']);
now, when page loads, receive error that:
uncaught referenceerror: require not defined
i believe makes sense because far know, require()
not valid command in javascript. module intended used angularjs app? or strictly nodejs app? can used in browser? sense missing fundamental here.
it looks library requires requirejs work correctly.
you can utilize browserify part of build step if don't want have requirejs
in app.
angularjs
No comments:
Post a Comment