I new in AngularJS. I am learning AngularJS. I am trying to follow
different tutorials. I working with some codes now. I have a question in
this regard. My codes ares as below

index.html

<html>
    <head>
        <title>AngularJS Application</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width">
        <script
src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.25/angular.min.js";></script>
        <script
src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.25/angular-route.js"></script>
        <script src="js/route.js"></script>
    </head>
    <body>
        <div ng-app="main_app">
            <div ng-controller="main_controller">
                <div ng-view></div>
            </div>
        </div>
    </body></html>

route.js

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

app.config(function($routeProvider){
   $routeProvider

   // route for the home page
   .when('/', {
               templateUrl : 'pages/home.html',
               controller  : 'main_controller'
            });});

app.controller('main_controller', function($scope) {
    alert('Yes');        });

If I run this code I get the alert('Yes'); twice.

Why I am getting this alert twice ?? Is it normal action or I am doing
something wrong ??



Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to