I don't know why the ng-bind is not showing the ng-init text

I’m following this simple step in my learning:

This is what I have. All dependencies have been downloaded to my computer and I am viewing the page through foundation watch, refreshing the web page after each save of the index.html page where I am working.

<!doctype html>
<html lang="en" ng-app="application">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Foundation for Apps</title>
    <link href="./assets/css/app.css" rel="stylesheet" type="text/css">
    <script src="./assets/js/foundation.js"></script>
    <script src="./assets/js/templates.js"></script>
    <script src="./assets/js/routes.js"></script>
    <script src="./assets/js/app.js"></script>
  </head>
  <body>
  <!--
  ng = Angular directive
  -->
<div ng-app="test" ng-init="firstName='John'" style="margin:20px;">
 
<p>ng-model of input fields connects text to {{ }} and ng-bind 2:</p>
Name : <input type="text" ng-model="lastname" placeholder="last name"></p>
<p><span ng-bind="firstname"></span></p>
<p>Hello {{lastname}}</p>

</div>
  </body>
</html>

Why doesn’t the ng-bind work? I suppose it is to immediately insert itself upon page refresh/load.

Could the example be Angular v1, but I installed Angular v2?

Probably case sensitivity. You have firstName in one spot and firstname in the other.

Corrected - that did it. OK - case matters!

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.