Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript AngularJS An Introduction to Two-Way Data Binding Looking at ng-model: Part 2

Damien Watson
Damien Watson
27,419 Points

'user.bio' data not displaying in the page.

This may be similar to the problem another user had, but the answer was unresolved due to lack of content: Connect hallo directive.

The main line copied from the video creates a 'div' with class 'textarea' and links the 'ng-model' as below. This should be populated from the datasource. I'm pretty sure its along the same lines as the video, maybe I have a typo somewhere?

Appreciate the help.

<body ng-app="MyApp" ng-controller="stageTwoCtrl">
  <div id="container">
    <div id="content">
      Hello {{user.name}}!
      <div class="textarea" ng-model="user.bio" hallo></div>
    <div id="debug">
      <pre>{{user | json}}</pre>
    <div class="clearFix"></div>

  <script src="https://code.jquery.com/jquery-1.11.0.min.js" type="text/javascript"></script>
  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.25/angular.min.js" type="text/javascript"></script>
  <script src="js/hallo.js" type="text/javascript"></script>
  <script src="js/app.js" type="text/javascript"></script>
angular.module("MyApp", []).
  controller("stageTwoCtrl", function($scope) {
    $scope.user = {
      "name": "world",
      "bio": "Roof party pop-up messenger bag Godard, Wes Anderson Carles pork belly Marfa selfies butcher. 3 wolf moon salvia listicle, normcore Marfa Carles gentrify meditation."
  .directive('hallo', function() {
    return {
      require: 'ngModel',
      link: function($scope, $element, $attrs, ngModelCtrl) {
          plugins: {
            'halloformat': {},
            'halloblock': {},
            'hallojustify': {},
            'hallolists': {},
            'halloreundo': {}

        ngModelCtrl.$render = function() {
          var contents = ngModelCtrl.$viewValue;
          $element.hallo('setContents', contents);