Service/Controllers

by Rob Rothe

HTML

<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<div ng-app="angular-tests" class="container">
  <scope-test>
    <h2>My Name?</h2>
    <input type="text" ng-model="text" />
    <p>{{text}}: Result {{result}}</p>
  </scope-test>
</div>

CSS

body {
  padding-top: 20px;
}

JavaScript

angular.module('angular-tests', [])
  .directive('scope-test', function($scope) {
      return {
        restrict: 'E',
        controller: function($scope) {
          $scope.$watch('text', function() {
              
            });
          }
        });