angular.module('modelDemo', []).
config(function ($routeProvider) {
$routeProvider.
when('/', {
controller: 'AuthorListCtrl',
templateUrl: 'list.html'
}).
otherwise({
redirectTo: '/'
});
});
angular.module('modelDemo').controller("AuthorListCtrl", ['$scope', 'Authors', function ($scope, Authors) {
$scope.Authors = Authors;
}]);
angular.module('modelDemo').service("Authors", [function () {
var fowler = {
name: "Fowler",
quote: "Any fool can write code that a computer can understand. Good programmers write code that humans can understand."
},
twain = {
name: "Twain",
quote: "Why, I have known clergymen, good men, kind-hearted, liberal, sincere, and all that, who did not know the meaning of a 'flush.' It is enough to make one ashamed of one's species."
},
poe = {
name: "Poe",
quote: "Deep into that darkness peering, long I stood there, wondering, fearing, doubting, dreaming dreams no mortal ever dared to dream before."
},
plato = {
name: "Plato",
quote: "All things will be produced in superior quantity and quality, and with greater ease, when each man works at a single occupation, in accordance with his natural gifts, and at the right moment, without meddling with anything else. "
};
this.list = [fowler, twain, poe, plato];
this.selectedAuthor = this.list[0];
}]);
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.