<!DOCTYPE html>
<html ng-app="agendaEditor">
<head>
<meta charset="UTF-8">
<title>AgendaEditor</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<link rel="stylesheet" href="css/style.css">
<script src="https://code.jquery.com/jquery-1.12.3.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular-route.min.js"></script>
<script src="js/app.js"></script>
<script src="js/HomeController.js"></script>
<script src="js/ImportController.js"></script>
<script src="js/AboutController.js"></script>
</head>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar">
<span class="sr-only">Menu</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">AgendaEditor</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="#home">Home</a></li>
<li><a href="#import">Import</a></li>
<li><a href="#about">About</a></li>
</ul>
</div>
</div>
</nav>
<div id="main">
<div ng-view></div>
</div>
</body>
</html>
app.controller('aboutController', function($scope) {
});
var app = angular.module('agendaEditor', ['ngRoute']);
app.config(function($routeProvider) {
$routeProvider
.when('/home', {
templateUrl: 'pages/home.html',
controller: 'homeController'
})
.when('/import', {
templateUrl: 'pages/import.html',
controller: 'importController'
})
.when('/about', {
templateUrl: 'pages/about.html',
controller: 'aboutController'
})
.otherwise({
redirectTo: '/home',
controller: 'homeController'
});
});
app.controller('homeController', function($scope) {
$scope.list = [];
$scope.list.push({title: "", name: "", surname: ""});
$scope.myResult = function () {
var result = [];
for (var i = 0; i < $scope.list.length; i++) {
var concat = "„" + $scope.list[i].title + "” – " + $scope.list[i].name + " " + $scope.list[i].surname;
if($scope.list[i].title !== ""){
result.push(concat);
}
}
return result;
};
$scope.addItem = function(){
$scope.list.push({title: "", name: "", surname: ""});
};
});
app.controller('importController', function($scope) {
});
<div class="container">
O aplikacji.
</div>
<div class="container">
<div class="row">
<div class="col-sm-6">
<table class="table">
<tr>
<td>Title</td>
<td>Name</td>
<td>Surname</td>
<td></td>
</tr>
<tr ng-repeat="item in list" ng-click="$last && addItem()">
<td><input class="form-control" type="text" ng-model="item.title"></td>
<td><input class="form-control" type="text" ng-model="item.name"></td>
<td><input class="form-control" type="text" ng-model="item.surname"></td>
<td><button ng-if="!$first" type="button" class="btn btn-danger btn-xs" ng-click="list.splice($index, 1)">-</button></td>
</tr>
</table>
<button type="button" class="btn btn-primary" ng-click="addItem()">Add</button><br />
</div>
<div class="col-sm-6">
<h3>Agenda</h3>
<div class="panel panel-default">
<div class="panel-body">
<p ng-repeat="item in myResult() track by $index">{{item}}</p>
</div>
</div>
</div>
</div>
</div>
<div class="container">
Tu będzie import.
</div>
body {
padding-top: 70px;
}