Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .bowerrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"directory": "app/bower_components"
}
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
bower_components
node_modules
target
bower_components/
node_modules/
target/

#IDEs
#IntelliJ Idea
.idea
.idea/
*.iml
8 changes: 7 additions & 1 deletion .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
"trailing": true,
"smarttabs": true,
"globals": {
"angular": true
"angular": true,
"describe": true,
"it": true,
"expect": true,
"module": true,
"inject": true,
"beforeEach": true
}
}
106 changes: 72 additions & 34 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,55 +1,93 @@
/*jshint camelcase:false*/
'use strict';

// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'

module.exports = function (grunt)
{
'use strict';

grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-karma');

require('load-grunt-tasks')(grunt);


var config = {
app: 'app'
};

grunt.initConfig({
config: config, watch: {
livereload: {
options: {
livereload: '<%= connect.options.livereload %>'
}, files: ['<%= config.app %>/**/*.html', '<%= config.app %>/**/*.js']
}
}, connect: {
options: {
port: 9000, livereload: 35729, hostname: 'localhost'
}, livereload: {
options: {
open: true, middleware: function (connect)
{
return [connect().use('/bower_components', connect.static('./bower_components')), connect.static(config.app)

];
config: config,
watch: {
livereload: {
options: {
livereload: '<%= connect.options.livereload %>'
},
files: ['<%= config.app %>/**/*.html', '<%= config.app %>/**/*.js']
}
},

connect: {
options: {
port: 9000,
livereload: 35729,
hostname: '127.0.0.1'
},
test: {
options: {
base: ['app'],
port: 9001
}
},
livereload: {
options: {
open: true,
middleware: function (connect)
{
return [connect().use('/bower_components', connect.static('./bower_components')), connect.static(config.app)

];
}
}
}
},
karma: {
options: {
configFile: 'test/karma.conf.js'
},
unit: {
singleRun: true
},
dev: {
singleRun: false
}
},
jshint: {
default: {
options: {
jshintrc: true
},
files: {
src: ['app/**/*.js', 'test/**/*.js', '!app/bower_components/**/*.js']
}
},
verify: {
options: {
jshintrc: true,
reporter: 'checkstyle',
reporterOutput: 'target/jshint.xml'
},
files: {src: ['app/**/*.js', 'test/**/*.js', '!app/bower_components/**/*.js']}
}
}
}
},
karma: {
unit: {
configFile: 'test/karma.conf.js'
}
}
});
);

grunt.registerTask('serve', ['connect:livereload', 'watch']);

grunt.registerTask('verify', ['jshint:verify', 'karma:unit']);

grunt.registerTask('serve', function ()
{
grunt.task.run(['connect:livereload', 'watch']);
});
grunt.registerTask('test:dev', ['karma:dev']);

grunt.registerTask('default', ['serve']);
};
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Excersie 1: Bind Posts
# Excersie 1: Bind Posts

##Introduction
## Introduction

This lesson is about following skills:

Expand All @@ -17,18 +17,18 @@ Expected result of this exercise is an application which allows user to display
| 1 | Jack | Diving Deep with Dependency Injection |
| 2 | Jill | Practical End-to-End Testing with Protractor |

##Before you start, read about...
## Before you start, read about...
* ng-repeat: [https://docs.angularjs.org/api/ng/directive/ngRepeat](https://docs.angularjs.org/api/ng/directive/ngRepeat)

##The exercise
## The exercise

To complete this exercise you need to follow these steps:

* add array of `posts` in `BlogPostCtrl.js`, each post with properties corresponding to the table headers from `index.html`

* use `ng-repeat` to display the rows

##Setup
## Setup
You should have installed `npm`, `bower`, `grunt` packages to run this example. First, run sequentially

```
Expand Down
3 changes: 1 addition & 2 deletions app/BlogPostCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@

}

var module = angular.module("exerciseApp", []);
module.controller('BlogPostCtrl', [BlogPostCtrl]);
angular.module('app', []).controller('BlogPostCtrl', [BlogPostCtrl]);
})();
41 changes: 22 additions & 19 deletions app/index.html
Original file line number Diff line number Diff line change
@@ -1,28 +1,31 @@
<!DOCTYPE html>
<html ng-app="exerciseApp">
<html ng-app="app">
<head lang="en">
<meta charset="UTF-8">
<title>Angular Exercise 1</title>
<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css">
</head>
<body class="container">
<div ng-controller="BlogPostCtrl as blogPosts">
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>ID</th>
<th>Author</th>
<th>Title</th>
</tr>
</thead>
<tbody>
<tr>
<th></th>
<th></th>
<th></th>
</tr>
</tbody>
</table>
<body>
<div ng-controller="BlogPostCtrl as blogPosta">
<div class="container">
<h2 class="page-header">How to use ng-repeat?</h2>
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>ID</th>
<th>Author</th>
<th>Title</th>
</tr>
</thead>
<tbody>
<tr>
<th></th>
<th></th>
<th></th>
</tr>
</tbody>
</table>
</div>
</div>

<script src="bower_components/angular/angular.js"></script>
Expand Down
5 changes: 2 additions & 3 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
"angular": "1.2.16",
"angular-resource": "1.2.16",
"bootstrap": "3.1.1"
},
},
"devDependencies": {
"angular-mocks": "1.2.16"
},
"appPath": "app"
}
}
32 changes: 16 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
{
"name": "angular-exercises",
"description": "Angular training",
"description": "angular training",
"version": "0.0.0",
"repository": "https://github.com/Real-Skill/angular-exercises.git",
"dependencies": {},
"devDependencies": {
"grunt": "0.4.2",
"grunt-contrib-jshint": "0.8.0",
"grunt-contrib-watch": "0.6.1",
"grunt": "0.4.5",
"grunt-cli": "0.1.13",
"grunt-contrib-connect": "0.7.1",
"grunt-karma": "0.9.0",
"karma-phantomjs-launcher": "0.1.4",
"karma": "0.12.16",
"karma-coverage": "0.2.4",
"karma-jasmine": "0.1.5",
"karma-spec-reporter": "0.0.13"
},
"engines": {
"node": ">=0.10.0"
"grunt-contrib-jshint": "0.11.3",
"grunt-contrib-watch": "0.6.1",
"grunt-karma": "2.0.0",
"karma": "1.4.1",
"karma-coverage": "0.3.1",
"karma-jasmine": "1.1.0",
"karma-junit-reporter": "0.2.2",
"karma-phantomjs-launcher": "1.0.2",
"karma-spec-reporter": "0.0.13",
"load-grunt-tasks": "0.4.0"
},
"repository": {
"type": "git",
"url": "https://github.com/aniaw/angular-exercises.git"
"scripts": {
"test": "grunt verify --force"
}
}
44 changes: 0 additions & 44 deletions test/.jshintrc

This file was deleted.

Loading