Angular BP

Simple boilerplate for AngularJS

by jonva

HTML

<div ng-app="myapp" ng-controller="mycontroller">
  <input type="text" ng-model="filterText.name">
  <ul>
    <li ng-repeat="item in items | filter: filterText">
     <news-listing date-value="{{item.name}}" category="{{item.name}}" content="{{item.email}}"></news-listing>
    </li>
  </ul>
</div>

JavaScript

angular.module('myapp', [])
  .controller('mycontroller', ['$scope', function mycontroller($scope) {
    $scope.items = [{
      name: 'john',
      email: '[email protected]'
    }, {
      name: 'amy',
      email: '[email protected]'
    }, {
      name: 'lee',
      email: '[email protected]'
    }, {
      name: 'jack',
      email: '[email protected]'
    }, {
      name: 'lisa',
      email: '[email protected]'
    }];
  }])
  .directive('newsListing', function() {
    return {
      restrict: 'AE',
      replace: 'true',
      template: '<div> < span class = "glyphicon glyphicon-list-alt logo-green" > < /span> < label > {{dateValue}} < /label> < label > {{category}} < /label> < label class = "noBorder" > {{content}} < /label>',
      scope: {
				dateValue: '@',
				content: '@',
				category: '@',
        
      },
      link: function(scope, elem, attrs) {
        //Fairly sure this is where the binding needs to happen?
      }
    };
  });