Skip to content

Instantly share code, notes, and snippets.

@anonymoussc
Created October 23, 2015 02:49
Show Gist options
  • Save anonymoussc/8b3052659949157a19ce to your computer and use it in GitHub Desktop.
Save anonymoussc/8b3052659949157a19ce to your computer and use it in GitHub Desktop.
Creating Multiple Views
<!DOCTYPE html>
<html ng-app="exampleApp">
<head>
<title>AngularJS Demo</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js"></script>
<script>
var myApp = angular.module("exampleApp", []);
myApp.controller("dayCtrl", function($scope) {
var dayNames = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
$scope.day = dayNames[new Date().getDay()];
$scope.tomorrow = dayNames[(new Date().getDay() + 1) % 7];
});
</script>
</head>
<body>
<div class="panel">
<div class="page-header">
<h3>AngularJS App</h3>
</div>
<h4 ng-controller="dayCtrl">Today is {{day || "(unknown)"}}</h4>
<h4 ng-controller="dayCtrl">Tomorrow is {{tomorrow || "(unknown)"}}</h4>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment