Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

Commit

Permalink
Merge pull request #196 from makkesk8/patch-1
Browse files Browse the repository at this point in the history
Added support for nw.js
  • Loading branch information
urish committed Nov 8, 2015
2 parents d5dde39 + 4a523aa commit 08f805b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions angular-moment.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,24 @@
function isUndefinedOrNull(val) {
return angular.isUndefined(val) || val === null;
}

function requireMoment() {
try {
return require('moment'); // Using nw.js or browserify?
} catch (e) {
throw new Error('Please install moment via npm. Please reference to: https://github.com/urish/angular-moment'); // Add wiki/troubleshooting section?
}
}

function angularMoment(angular, moment) {

if(typeof moment === 'undefined') {
if(typeof require === 'function') {
moment = requireMoment();
}else{
throw new Error('Moment cannot be found by angular-moment! Please reference to: https://github.com/urish/angular-moment'); // Add wiki/troubleshooting section?
}
}

/**
* @ngdoc overview
Expand Down

0 comments on commit 08f805b

Please sign in to comment.