Skip to content

Instantly share code, notes, and snippets.

@kfiil
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kfiil/bc5d0f3634c6c98870f8 to your computer and use it in GitHub Desktop.
Save kfiil/bc5d0f3634c6c98870f8 to your computer and use it in GitHub Desktop.
AngularJS kursus, custom directives shared scope
var app = angular.module('directivesModule');
app.controller('Controller', ['$scope', function ($scope) {
$scope.customer = {
name: 'David',
street: '1234 Anywhere St.'
};
}]);
app.directive('sharedScope', function () {
return {
template: 'Name: {{customer.name}} Street: {{customer.street}}'
};
});
// Scope is inherited, output Name: David Street: 1234 Anywhere St.
// <div shared-scope></div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment