I am brand new in AngularJS and I find some difficulties trying to figure out exactly how it implements the MVC pattern.
So, I have this first doubt related to this example, in which I have 2 files:
1) index.htm :
<!DOCTYPE html>
<html lang="en-us" ng-app="angularApp">
<head>
<title>Introduction to AngularJS</title>
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<meta charset="UTF-8">
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" />
<style>
html, body
{
font-size: 1.1em;
}
</style>
<script src="//code.angularjs.org/1.3.0-rc.1/angular.min.js"></script>
<script src="app.js"></script>
</head>
<body>
<header>
<nav class="navbar navbar-default">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="/">AngularJS</a>
</div>
<ul class="nav navbar-nav navbar-right">
<li><a href="#"><i class="fa fa-home"></i> Home</a></li>
</ul>
</div>
</nav>
</header>
<div class="container">
<div ng-controller="mainController">
<h1>Hello world!</h1>
</div>
</div>
</body>
</html>
2) app.js file :
var angularApp = angular.module('angularApp', []);
angularApp.controller('mainController', ['$scope', function ($scope) {
}]);
I find some difficulties trying to determine who is a MODEL , who is a CONTROLLER , and who is VIEW .
It seems to me that I realized that the ng-app = "angularApp" attribute defined in the html tag:
<html lang="en-us" ng-app="angularApp">
bind the entire index.htm page to an angularApp variable
var angularApp = angular.module('angularApp', []);
, angularApp? Angular ? Angular?