AngularJS Service Dependencies

by Edward Tanguay

HTML

<script src="//code.jquery.com/jquery-1.11.2.min.js"></script>
<div ng-app="app">
    <div ng-controller="CalculatorController">
        <div id="calendar"></div>
        <button class="btn btn-default" ng-click="alterCalender()">Alter Calendar</button>
    </div>
</div>

CSS

body {
    font-family:sans-serif;
    background-color: #f5f5f5;
}
div {
    margin:20px 5px;
}

JavaScript

angular.module('app', [])
.controller('CalculatorController', function($scope) {
    
    $scope.displayCalendar = function() {
    	return $('#calendar').html('initial calendar');  
    };
    
    $scope.displayCalendar2 = function() {
    	return $('#calendar').html('ALTERED calendar');  
    };
    
    $scope.displayCalendar();
    
    $scope.alterCalender = function() {
    	$scope.displayCalendar2();    
    };
});