Skip to content

Commit 0813e47

Browse files
committed
Added angular sample app
1 parent 8dfa574 commit 0813e47

File tree

13 files changed

+180
-0
lines changed

13 files changed

+180
-0
lines changed

example/angular/.bowerrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"directory": "app/bower_components"
3+
}

example/angular/README.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
### Run the Application
2+
3+
We have preconfigured the project with a simple development web server. The simplest way to start this server is:
4+
5+
```
6+
npm start
7+
```
8+
9+
Now browse to the app at `http://localhost:8000/index.html`.

example/angular/app/app.constants.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
(function () {
2+
'use strict';
3+
4+
var app = angular.module('myApp');
5+
app.constant('APP_CONSTANTS', {
6+
EXCEPTIONLESS_API_KEY: 'LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw',
7+
EXCEPTIONLESS_SERVER_URL: 'http://localhost:50000'
8+
});
9+
})();
10+

example/angular/app/app.css

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
.menu {
2+
list-style: none;
3+
border-bottom: 0.1em solid black;
4+
margin-bottom: 2em;
5+
padding: 0 0 0.5em;
6+
}
7+
8+
.menu:before {
9+
content: "[";
10+
}
11+
12+
.menu:after {
13+
content: "]";
14+
}
15+
16+
.menu > li {
17+
display: inline;
18+
}
19+
20+
.menu > li + li:before {
21+
content: "|";
22+
padding-right: 0.3em;
23+
}

example/angular/app/app.js

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
(function () {
2+
'use strict';
3+
4+
var app = angular.module('myApp', [
5+
'exceptionless',
6+
'myApp.view1',
7+
'myApp.view2'
8+
]);
9+
10+
app.config(function(APP_CONSTANTS, $ExceptionlessClient) {
11+
$ExceptionlessClient.config.apiKey = APP_CONSTANTS.EXCEPTIONLESS_API_KEY;
12+
$ExceptionlessClient.config.serverUrl = APP_CONSTANTS.EXCEPTIONLESS_SERVER_URL;
13+
$ExceptionlessClient.config.useDebugLogger();
14+
$ExceptionlessClient.config.setUserIdentity('12345678', 'Blake');
15+
$ExceptionlessClient.config.useSessions();
16+
$ExceptionlessClient.config.defaultTags.push('Example', 'JavaScript', 'Angular');
17+
});
18+
19+
app.run(function ($log) {
20+
$log.info('App starting up...');
21+
});
22+
})();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
(function () {
2+
'use strict';
3+
4+
angular.module('myApp')
5+
.factory('userService', userService);
6+
7+
function userService($http) {
8+
return {
9+
getAll: getAll
10+
};
11+
12+
function getAll() {
13+
return $http.get('http://random_domain_name_that_doesnt_exist.com/api/users');
14+
}
15+
}
16+
})();

example/angular/app/index.html

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<!DOCTYPE html lang="en">
2+
<head>
3+
<meta charset="utf-8">
4+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
5+
<title>Exceptionless Angular Sample App</title>
6+
<meta name="viewport" content="width=device-width, initial-scale=1">
7+
<link rel="stylesheet" href="bower_components/html5-boilerplate/dist/css/normalize.css">
8+
<link rel="stylesheet" href="bower_components/html5-boilerplate/dist/css/main.css">
9+
<link rel="stylesheet" href="app.css">
10+
<script src="bower_components/html5-boilerplate/dist/js/vendor/modernizr-2.8.3.min.js"></script>
11+
</head>
12+
<body ng-app="myApp">
13+
<ul class="menu">
14+
<li><a ui-sref="view1">View1 - Throws Controller Exception</a></li>
15+
<li><a ui-sref="view2">View2 - Invalid Http Call</a></li>
16+
</ul>
17+
18+
<div ui-view></div>
19+
20+
<script src="bower_components/angular/angular.js"></script>
21+
<script src="bower_components/angular-ui-router/release/angular-ui-router.js"></script>
22+
<script src="bower_components/exceptionless/dist/exceptionless.js"></script>
23+
<script src="bower_components/exceptionless/dist/integrations/angular.js"></script>
24+
<script src="app.js"></script>
25+
<script src="app.constants.js"></script>
26+
<script src="view1/view1.js"></script>
27+
<script src="view2/view2.js"></script>
28+
<script src="components/user.service.js"></script>
29+
</body>
30+
</html>

example/angular/app/view1/view1.html

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<p>This view throws an exception while loading the controller.</p>

example/angular/app/view1/view1.js

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
(function () {
2+
'use strict';
3+
4+
angular.module('myApp.view1', ['ui.router'])
5+
.config(routerConfig)
6+
.controller('View1Ctrl', function () {
7+
throw "Error occurred inside of View1Ctrl";
8+
});
9+
10+
function routerConfig($stateProvider) {
11+
$stateProvider
12+
.state('view1', {
13+
url: '/view1',
14+
templateUrl: 'view1/view1.html',
15+
controller: 'View1Ctrl'
16+
});
17+
}
18+
})();

example/angular/app/view2/view2.html

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<p>This view throws an $http error trying to get an invalid html resource.</p>

example/angular/app/view2/view2.js

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
(function () {
2+
'use strict';
3+
4+
angular.module('myApp.view2', ['ui.router', 'myApp'])
5+
.config(routerConfig)
6+
.controller('View2Ctrl', function (userService) {
7+
var users = userService.getAll();
8+
});
9+
10+
function routerConfig($stateProvider) {
11+
$stateProvider
12+
.state('view2', {
13+
url: '/view2',
14+
templateUrl: 'view2/view2.html',
15+
controller: 'View2Ctrl'
16+
});
17+
}
18+
})();

example/angular/bower.json

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "exceptionless-angular-example",
3+
"description": "An Exceptionless sample angular app",
4+
"homepage": "https://github.com/exceptionless/Exceptionless.JavaScript",
5+
"private": true,
6+
"dependencies": {
7+
"angular": "^1.5.8",
8+
"angular-loader": "^1.5.8",
9+
"angular-ui-router": "^0.3.1",
10+
"exceptionless": "^1.4.1",
11+
"html5-boilerplate": "^5.3.0"
12+
}
13+
}

example/angular/package.json

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"name": "exceptionless-angular-example",
3+
"private": true,
4+
"description": "An Exceptionless sample angular app",
5+
"repository": "https://github.com/exceptionless/Exceptionless.JavaScript",
6+
"devDependencies": {
7+
"bower": "^1.7.7",
8+
"http-server": "^0.9.0"
9+
},
10+
"scripts": {
11+
"postinstall": "bower install",
12+
13+
"prestart": "npm install",
14+
"start": "http-server -a localhost -p 8000 -c-1 ./app"
15+
}
16+
}

0 commit comments

Comments
 (0)