Basic AngularJS start

by laguiz

HTML

<link rel="stylesheet" href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css">
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<div ng-controller="MyController">
    <button ng-click="toto(); titi();">Click me (two methods in one ng-click)</button>
    <button ng-click="wrap();">Click me (one method that wrap 2 methods)</button>
</div>

JavaScript

var app = angular.module('myApp', []);


function MyController($scope) {
    
    $scope.toto = function(){
        alert('toto');
    };
    
    $scope.titi = function(){
        alert('titi');
    };
    
    $scope.wrap = function(){
        $scope.toto();
        $scope.titi();
    };

}