Skip to content

Commit f0f0f69

Browse files
author
Alex Ross
committed
Refactored segment
1 parent 7492748 commit f0f0f69

10 files changed

Lines changed: 455 additions & 121 deletions

File tree

example.html

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<!DOCTYPE html>
2+
<html ng-app="example">
3+
<head>
4+
<title>ngSegment Example</title>
5+
6+
<!-- Angular -->
7+
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.js"></script>
8+
9+
<!-- ngSegment -->
10+
<script src="segment.js"></script>
11+
12+
<!-- Example Angular application -->
13+
<script>
14+
15+
// Provider configuration
16+
angular.module('example', ['ngSegment']).config(function (segmentProvider, segmentLoaderProvider) {
17+
console.log('segmentProvider:', segmentProvider);
18+
console.log('segmentLoaderProvider:', segmentLoaderProvider);
19+
20+
// segmentLoaderProvider.load();
21+
});
22+
23+
// Service configuration and usage
24+
angular.module('example').controller('ExampleController', function (segment, segmentLoader) {
25+
26+
console.log('segment:', segment);
27+
console.log('segmentLoader:', segmentLoader);
28+
// segmentLoader.load();
29+
});
30+
31+
angular.module('example').constant('segmentConfig', {
32+
debug: false
33+
});
34+
35+
// Events constant example. This is optional.
36+
angular.module('example').constant('ExampleEvents', {
37+
38+
});
39+
</script>
40+
41+
<!-- Bootstrap -->
42+
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
43+
</head>
44+
<body ng-controller="ExampleController">
45+
<div class="jumbotron">
46+
<div class="container">
47+
<h1>Example</h1>
48+
</div>
49+
</div>
50+
<div class="container">
51+
52+
</div>
53+
</body>
54+
</html>

grunt/aliases.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"build": [
3+
"concat"
4+
]
5+
}

grunt/concat.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module.exports = {
2+
3+
js: {
4+
src: [
5+
'src/module.js',
6+
'src/**/*.js'
7+
],
8+
dest: 'segment.js'
9+
}
10+
};

grunt/watch.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module.exports = {
2+
options: { livereload: false },
3+
js: {
4+
files: ['src/**/*.js'],
5+
tasks: ['build']
6+
},
7+
livereload: {
8+
files: [ 'segment.js', 'example.html' ],
9+
options: { livereload: true }
10+
}
11+
};

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
"load-grunt-tasks": "^3.2.0",
77
"semver": "^5.0.1",
88
"grunt-contrib-uglify": "^0.9.1",
9+
"grunt-contrib-concat": "^0.5.1",
10+
"grunt-contrib-watch": "^0.6.1",
911
"grunt-bump": "^0.3.1",
1012
"grunt-prompt": "^1.3.0"
1113
}

0 commit comments

Comments
 (0)