diff --git a/index.html b/index.html index 5204d3fd..74df69d2 100644 --- a/index.html +++ b/index.html @@ -12,11 +12,6 @@

UF Directory App

@@ -27,28 +22,39 @@

UF Directory App

Building Name - + < + {{listing.code}} + {{listing.name}} + +    +
- +

Add New Listing

+
+

Code:

+ +
+

Building Name:

+ +
+

Coordinates:

+ +
+ +
+

Address:

+ +

+    +

Detailed Information

@@ -62,4 +68,4 @@

Detailed Information

- \ No newline at end of file + diff --git a/listingController.js b/listingController.js index 6d71d99e..ec1a258d 100644 --- a/listingController.js +++ b/listingController.js @@ -4,11 +4,25 @@ angular.module('listings').controller('ListingsController', ['$scope', 'Listings $scope.detailedInfo = undefined; /* - Implement these functions in the controller to make your application function - as described in the assignment spec. + + + + + */ - $scope.addListing = function() {}; - $scope.deleteListing = function(index) {}; - $scope.showDetails = function(index) {}; + $scope.addListing = function() { + if ($scope.listing.code && $scope.listing.name){ + $scope.listing.code = $scope.listing.code.toUpperCase(); + $scope.listings.push($scope.listing); + $scope.listing = ""; + } + }; + $scope.deleteListing = function(index) { + if($scope.listings[i].code == index.code) { + $scope.listings.splice(i, 1); + } + }; + $scope.showDetails = function(index) { + }; } -]); \ No newline at end of file +]);