egghead.io $scope vs scope

by jank0003

HTML

<div ng-app="drinkApp">
  <div ng-controller="AppCtrl">
      <input type="text" ng-model="ctrlFlavor">
      <div drink flavor = "{{ctrlFlavor}}"></div>
  </div>
</div>

JavaScript

'use strict';

// Declare app level module which depends on views, and components
var app = angular.module('drinkApp',[])

app.controller("AppCtrl", function($scope){
  $scope.ctrlFlavor = "blackberry"
})

app.directive("drink", function() {
  return {
    scope:{
      flavor:"@"
    },
    template: '<div>{{flavor}}</div>',
    link: function(scope, element, attrs){
      scope.flavor=attrs.flavor;
    }
  }
})