Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what does <!-- ngView : undefined --> mean

I get a dom like this:

<div class="row">
  <::before>
    <div class="col-lg-12">
      <!-- ngView: undefined -->
        <ng-view class="ng-scope">
          <h1 class="ng-scope">Hello world</h1>
        </ng-view>
    </div>
  <::after>
</div>

What does:

    <!-- ngView: undefined -->

mean?

Everything seems to work fine, but I don't like this comment as it seems that something is not working properly?

The template look like this:

<h1>Hello world</h1>

and it is configured like this :

var myApp = angular.module('myApp', [
'ngRoute',

.....

]);

myApp.config(['$routeProvider', function($routeProvider){
$routeProvider.when('/my_template', {templateUrl: '/web-angular/my_template.html'})
.when( .....  );
}]);
like image 226
Tom Avatar asked Dec 22 '13 19:12

Tom


2 Answers

Place your 'ng-view' directive in a div or span. Such as ...

<div ng-view></div>
<span ng-view></span>

Check out the IE restrictions here AngularJS IE Guide and take a look at number 3 and 4. From this, I take it that this is simply a warning. Something to catch your attention, and mine, just as it did. Note that declaring ng-view in your class will still work, but you will get the same warning message in your markup.

like image 96
Phillip Jackson Avatar answered Sep 23 '22 19:09

Phillip Jackson


For anyone else coming across this and not having any luck with the other answer, I had this problem because I hadn't included the controller as a dependency of the module.

angular.module('myApp', ['module-for-missing-page'])

Including this dependency got the view loading correctly.

like image 22
Steve Greatrex Avatar answered Sep 22 '22 19:09

Steve Greatrex