ng-bind on <title> doesn't work
Asked Answered
P

1

7

Using 1.3.0-rc1 (latest now).

I tried:

<title ng-bind="title"></title>

<title>{{title}}</title>

But nothing.

If I do {{title}} anywhere in <body> it works.

I'm doing:

app.main.run(function($rootScope) {
    $rootScope.$on('$routeChangeSuccess', function(event, current, previous) {
        if (current.hasOwnProperty('$$route')) {
            $rootScope.title = current.$$route.title;
        }
    });
});

I can see my title in the model. What's going on with the <title> tag?

Pufahl answered 11/9, 2014 at 10:34 Comment(3)
where did you define your app & controller? Make sure it's on the <html> tagSherasherar
@DieterGoetelen yeah you are right, I forgot that, my ng-app was on <body> instead of <html>! Thank'sPufahl
since this is answered you should answer the question or close it.Vapory
P
5

This is fixed by adding ng-app on <html> tag.

Pufahl answered 11/9, 2014 at 10:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.