Skip to content

Commit 5d5c1e6

Browse files
committed
#232 - make module factory return a module name
Allow doing something like this: ``` var angular = require('angular'); var app = angular.module('app', [ require('angular-chart') ]); ```
1 parent a5d5b0f commit 5d5c1e6

16 files changed

Lines changed: 78 additions & 9 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ node_modules/
33
test/fixtures/shots/
44
coverage/
55
examples/bundle.js
6+
examples/commonjs.bundle.js

.jscsrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
"dist/**",
7676
"coverage/**",
7777
"examples/bundle.js",
78+
"examples/commonjs.bundle.js",
7879
"examples/smoothscroll.min.js",
7980
"test/fixtures/coverage.js"
8081
]

.jshintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ node_modules/
22
dist/
33
tmp/
44
examples/bundle.js
5+
examples/commonjs.bundle.js
56
examples/smoothscroll.min.js
67
coverage/
78
test/fixtures/coverage.js

.jshintrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
"trailing" : true, // Prohibit trailing whitespaces.
77
"white" : false, // Check against strict whitespace and indentation rules.
88
"indent" : 2, // {int} Number of spaces to use for indentation
9+
"maxcomplexity" : 10, // {int} Max number for cyclomatic complexity
10+
"maxdepth" : 2, // {int} Max number for nesting blocks
911
"newcap" : true, // true: Require capitalization of all constructor functions e.g. `new F()`
1012
"quotmark" : "single", // Quotation mark consistency
1113
"-W058" : true, // Missing '()' invoking a constructor

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ script and options.
1717
## Chart.js 2.0 and 1.0.0-alpha branch
1818

1919
This is the `1.0.0-alpha` branch which requires Chart.js 2.0.0 version. Following semantic versioning,
20-
there are numerous breaking changes in this version notably:
20+
there are numerous **breaking changes** in this version notably:
2121

2222
* all options now need to use the `chart-` prefix
2323
* `chart-colours` is now `chart-colors` and `chart-get-colour` is now `chart-get-color`
@@ -28,6 +28,7 @@ there are numerous breaking changes in this version notably:
2828
* obviously all Chart.js breaking changes as well in how options are set, etc.
2929
* disabling the `responsive` option doesn't work via global `Chart.defaults.global.responsive` anymore,
3030
but must be set via standard options e.g. `ChartJsProvider.setOptions({ responsive: false });`
31+
* factory now returns a module name instead of a module instance
3132

3233
### npm
3334

angular-chart.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@
4848
.directive('chartRadar', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('radar'); }])
4949
.directive('chartDoughnut', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('doughnut'); }])
5050
.directive('chartPie', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('pie'); }])
51-
.directive('chartPolarArea', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('polarArea'); }]);
51+
.directive('chartPolarArea', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('polarArea'); }])
52+
.name;
5253

5354
/**
5455
* Wrapper for chart.js

dist/angular-chart.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@
4848
.directive('chartRadar', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('radar'); }])
4949
.directive('chartDoughnut', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('doughnut'); }])
5050
.directive('chartPie', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('pie'); }])
51-
.directive('chartPolarArea', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('polarArea'); }]);
51+
.directive('chartPolarArea', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('polarArea'); }])
52+
.name;
5253

5354
/**
5455
* Wrapper for chart.js

dist/angular-chart.js.tar.gz

22 Bytes
Binary file not shown.

dist/angular-chart.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/angular-chart.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)