Showing posts with label AngualrJS for .Net developers in24 hours. Show all posts
Showing posts with label AngualrJS for .Net developers in24 hours. Show all posts

Tuesday, February 9, 2016

AngualrJS for .Net developers in24 hours hours 5 page 46

the code missing declare app variable

AngualrJS for .Net developers in24 hours hours 5 page 43

<!DOCTYPE html>
<html>
<head>
    <title>test</title>
<meta charset="utf-8" />
    <script src="scripts/angular.js"></script>
    <script src="scripts/app.js"></script>
</head>
<body>
    <div ng-app="musicApp">
    <div ng-controller="ArtistController">
        {{artist}}
        <button ng-click="pumpkins()">Pumpkins</button>
        <button ng-click="rise()">Rise</button>
    </div>
</div>
</body>
</html>

angular.module('musicApp',[])
.controller('ArtistController', ['$scope', ArtistController]);
function ArtistController($scope) {
    $scope.artist = 'Foo';
    $scope.pumpkins = function () {
        $scope.artist = "pumpkins";
    }
    $scope.rise = function () {
        $scope.artist = "Rise";
    }
}