Skip to content

Instantly share code, notes, and snippets.

@fraserxu
Last active December 16, 2015 19:49
Show Gist options
  • Save fraserxu/5487504 to your computer and use it in GitHub Desktop.
Save fraserxu/5487504 to your computer and use it in GitHub Desktop.
Head部分代码
module.directive('header', function () {
return {
restrict: 'A',
replace: true,
scope: {user: '='}, // 后面将会解释为何这么写
templateUrl: "/js/directives/header.html",
controller: ['$scope', '$filter', function ($scope, $filter) {
// 控制器
}]
}
})
<div>
<p>
This part of the header is always here
</p>
<p ui-if="user">
User {{user.name}} is logged in :D
</p>
<p ui-if="!user">
Hey buddy, log in! Be cool
</p>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment