Did you change the value of title to your own String?


#1

In first app, I completed first page and in second page despite title and h1 is correct, it always throw error:
Did you change the value of title to your own String?

Can someone please help, below is the code snippet and error screen shot is also uploaded.

app.js:

var app = angular.module("myApp", []);

MainController.js:

app.controller('MainController', ['$scope', function($scope) {
  
  $scope.title = 'Top Sellers in Books';
}]);

index.html:

<!doctype html>
<html>
  <head>
      <link href="https://s3.amazonaws.com/codecademy-content/projects/bootstrap.min.css" rel="stylesheet" />
    <link href='https://fonts.googleapis.com/css?family=Roboto:500,300,700,400' rel='stylesheet' type='text/css'>
    <link href="css/main.css" rel="stylesheet" />

    <!-- Include the AngularJS library -->
    <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.5/angular.min.js"></script>
  </head>
  <body ng-app="myApp">
    <div class="header">
      <div class="container">
        <h1>Book End</h1>
      </div>
    </div>

    <div class="main" ng-controller='MainController'>
      <div class="container">

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

      </div>
    </div>

    <div class="footer">
      <div class="container">
        <h2>Available for iPhone and Android.</h2>
        <img src="https://s3.amazonaws.com/codecademy-content/projects/shutterbugg/app-store.png" width="120px" />
        <img src="https://s3.amazonaws.com/codecademy-content/projects/shutterbugg/google-play.png" width="110px" />
      </div>
    </div>


    <!-- Modules -->
    <script src="js/app.js"></script>

    <!-- Controllers -->
    <script src="js/controllers/MainController.js"></script>

  </body>
</html>

#2

@nikhiljoshi2,
Could you give is the FULL HTML-code you are using as =text=......

edit your Post

  • leave one blank-line above of your code
  • select your code in the Post
  • then =click= on the </>-symbol-of-this-editor

Your code will then be in a pre-code state
and you will be able to make/present the proper indentations.

With Courtesy to stetim94
https://discuss.codecademy.com/t/im-having-a-problem-on-lesson-11-23/2307/3?u=leonhard.wettengmx.n

or even better use
= https://discuss.codecademy.com/t/how-do-i-format-code-in-my-posts/28351
[extra's]
https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet


#3

Hello,thank you for reply, I have updated as per your guidance.


#4

@nikhiljoshi2,
You must have understanding, how to work with objects

$scope is the object
and title is a property of this object
and with $scope.title you will get access to the associated string Value

MainController.js:

app.controller('MainController', ['$scope', function($scope) {
    $scope.title = 'Top Sellers in Books';
}]);

You will have to remove
<img src="//codecademy-discourse.s3.amazonaws.com/original/4X/a/7/d/a7d69a5364257ee4e0a30212f05d4daf98c117db.jpg" width="689" height="312">
from the MainController.js


#5

@nikhiljoshi2,

I would suggest you change 'Top Sellers in Books' into This is a test'
to then have
$scope.title = 'This is a test';


#6

I am sorry, that was incorrect paste, my code is correct and actually I understand $scope and its relationship with controller and ui. Can you please help more?


#7

I got the answer, it is asking me to change the text and I was keeping it the same, thank you for the help.


#8

@nikhiljoshi2,
You meant the title text ???


#9

Yeah, sorry, it was my bad, now it is solved. Thank you for all the help.