Problems with the ng-app directive of angular.js

0

good morning, I have a problem in my project, when I add the directive ng-app="miApp" I get an error by the console

Otherwise, if you do not place the directive ng-app="miApp" , it does not show any error, even if you only place the% ng-app directive, the name of the application works perfectly.

<!DOCTYPE html>
<html ng-app="miApp">
  <head>
    <meta charset="utf-8">
    <title>AllMarket</title>
    <link rel="stylesheet" href="public/stylesheets/style.css">
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.17/angular.min.js"></script>
    <script src="https://code.angularjs.org/1.2.21/angular-route.min.js"></script>
  </head>
  <body>
    <div ng-include src=" 'plantillas/encabezado.html' "></div>
    <div ng-include src=" 'plantillas/menu.html' "></div>
    <h1>Visita el NG-ZOO</h1>
    <div ng-view></div>
    <ul class="menu">
      <li> <a href="#/animales/ave1">Ave 1</a></li>
      <li> <a href="#/animales/ave2">Ave 2</a></li>
      <li> <a href="#/animales/ave3">Ave 3</a></li>
    </ul>
  </body>
</html>

Why is the error thrown by console?

    
asked by Daniel Enrique Rodriguez Caste 31.03.2017 в 00:59
source

1 answer

0

It is necessary that you create the miApp module, example:

<html ng-app="App">
  <head>
  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
  <script>
    var app = angular.module('App',[]);
  </script>
   </head>
   <body><h1>App</h1></body>
</html>
    
answered by 31.03.2017 / 16:45
source