Skip to content

Commit a286c76

Browse files
committed
Stable Version 4.2.1.
Updated dependencies Better commonjs interop Added a number of build examples Fixes #166 Fixes #183 Fixes #185
1 parent cbeb9eb commit a286c76

26 files changed

+312
-133
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ coverage/Firefox*/*
1515
coverage/
1616

1717
bower_components/
18+
19+
build_examples/**/bundle.js
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Running `browserify app.js > bundle.js` in this directory will produce `bundle.js`

build_examples/browserify/app.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
var angular = require('angular');
2+
3+
angular.module('app', [
4+
// this is what you would do in a real app
5+
// require('angular-cache')
6+
7+
// for the example to work
8+
require('../../dist/angular-cache.js')
9+
]).run(function ($rootScope, CacheFactory) {
10+
$rootScope.test = 'It works! Using ' + (CacheFactory ? 'angular-cache' : 'undefined');
11+
});
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!DOCTYPE html>
2+
<html ng-app="app">
3+
<head>
4+
<title>My App</title>
5+
<!-- load bundled scripts -->
6+
<script src="bundle.js"></script>
7+
</head>
8+
<body>
9+
<h1>{{ test }}</h1>
10+
</body>
11+
</html>

build_examples/r.js/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Running `r.js -o require.config.js` in this directory will produce `bundle.js`
2+
3+
In `index.html` switch `script/main` between `main` (load scripts dynamically) and `bundle` (load bundled scripts)

build_examples/r.js/app.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
define('app', [
2+
'angular',
3+
'angular-cache'
4+
], function (angular, angularCacheModuleName) {
5+
return angular.module('app', ['angular-cache'])
6+
.run(function ($rootScope) {
7+
$rootScope.test = 'It works! Using ' + angularCacheModuleName;
8+
});
9+
});

build_examples/r.js/index.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>My App</title>
5+
<!-- load scripts dynamically -->
6+
<script data-main="main" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.17/require.min.js"></script>
7+
8+
<!-- load bundled scripts -->
9+
<!--<script data-main="bundle" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.17/require.min.js"></script>-->
10+
</head>
11+
<body ng-cloak>
12+
<h1>{{ test }}</h1>
13+
</body>
14+
</html>

build_examples/r.js/main.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
require.config({
2+
paths: {
3+
angular: '../../bower_components/angular/angular',
4+
'angular-cache': '../../dist/angular-cache',
5+
},
6+
shim: {
7+
'angular': {
8+
exports: 'angular'
9+
}
10+
}
11+
});
12+
13+
require([
14+
'angular',
15+
'app'
16+
], function (angular, app) {
17+
angular.element(document.getElementsByTagName('html')[0]).ready(function () {
18+
// bootstrap the app manually
19+
angular.bootstrap(document, ['app']);
20+
});
21+
}
22+
);
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
({
2+
name: 'main',
3+
mainConfigFile: 'main.js',
4+
out: 'bundle.js',
5+
optimize: 'none'
6+
})

build_examples/webpack/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Running `webpack` in this directory will produce `bundle.js`

0 commit comments

Comments
 (0)