This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
contactApp.controller('contactController', | |
['$scope', 'contactDataService', '$location', | |
function categoryController($scope, contactDataService) { | |
$scope.contacts = []; | |
loadContactData(); | |
function loadContactData() { | |
contactDataService.getContacts() | |
.then(function () { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Contacts.Helpers; | |
using Contacts.Models; | |
using System.Web.Mvc; | |
namespace Contacts.Controllers | |
{ | |
public class ContactController : JsonController | |
{ | |
private ContactContext ContactsDB = new ContactContext(); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
contactApp.factory('contactDataService', ['$http', '$q', | |
function ($http, $q) { | |
var _contacts = []; | |
var _getContacts = function () { | |
var deferred = $q.defer(); | |
var controllerQuery = "contact/GetContacts"; | |
$http.get(controllerQuery) | |
.then(function (result) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Newtonsoft.Json; | |
using Newtonsoft.Json.Serialization; | |
using System; | |
using System.Net; | |
using System.Web.Mvc; | |
namespace Contacts.Helpers | |
{ | |
public class JsonController : Controller | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using System.Data.Entity; | |
using System.Linq; | |
namespace Contacts.Models | |
{ | |
public class ContactContext : DbContext | |
{ | |
public DbSet<Contact> Contacts { get; set; } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Contacts.Models | |
{ | |
public class Contact | |
{ | |
public int Id {get;set;} | |
public string FirstName { get; set; } | |
public string LastName { get; set; } | |
public string Email { get; set; } | |
public string Mobile { get; set; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bundles.Add(new ScriptBundle("~/bundles/angularApp").Include( | |
"~/Scripts/Angular1.3.5/angular.js", | |
"~/Scripts/Angular1.3.5/angular-route.js", | |
"~/Scripts/Angular1.3.5/angular-resource.js", | |
"~/App/contactApp.js", | |
"~/App/clientRoute.js", | |
"~/App/contact/controller/contactController.js" | |
)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
contactApp.config(['$routeProvider', function ($routeProvider) { | |
$routeProvider.when('/', { | |
templateUrl: "/app/Home/home.html" | |
}), | |
$routeProvider.when('/about', { | |
templateUrl: "app/Home/about.html" | |
}), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="navbar-collapse collapse"> | |
<ul class="nav navbar-nav"> | |
<li><a href="#/">Home</a></li> | |
<li><a href="#/mycontacts">My Contacts</a></li> | |
<li><a href="#/about">about</a></li> | |
</ul> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="panel panel-primary"> | |
<div class="panel-heading">New Contact</div> | |
<div class="panel-body"> | |
<form class="form-horizontal" role="form" id="contactForm" name="contactForm"> | |
<div class="form-group"> | |
<label for="firstName" class="col-sm-3 control-label">First Name</label> | |
<div class="col-sm-6"> |