Skip to content

Instantly share code, notes, and snippets.

@sunkay
sunkay / main.html
Created April 21, 2013 20:50
main.html which using angular ng-view
<html ng-app="cotd">
<head>
<title>Check out your device</title>
<link rel="stylesheet" href="../bootstrap/css/bootstrap.css">
</head>
<body>
<h2>List of Devices</h2>
<div ng-view></div>
@sunkay
sunkay / deviceService.js
Created April 21, 2013 20:42
Angular Module
// create a module to support getting and managing the device list
var deviceModule = angular.module('DeviceModule', []);
// setup the service factory to create our items. Should retrieve from the server side db
deviceModule.factory('Devices', function(){
var items = {};
items.query = function(){
return [
{id:0, name: "iphone", assetTag:"a23456", owner:"dev", desc:"iOS4.2"},
// controllers
function deviceListController($scope)
{
$scope.devices = [
{name: "iphone", assetTag:"a23456", owner:"dev", desc:"iOS4.2"},
{name: "loaner-laptop-1", assetTag:"a13936", owner:"dev", desc:""},
{name: "loaner-laptop-3", assetTag:"a43056", owner:"qa", desc:""},
{name: "android", assetTag:"a33756", owner:"dev", desc:"android2.4"},
{name: "galaxy tab", assetTag:"a53356", owner:"dev", desc:"android"},