Last active
December 16, 2015 19:49
-
-
Save fraserxu/5487504 to your computer and use it in GitHub Desktop.
Head部分代码
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.directive('header', function () { | |
return { | |
restrict: 'A', | |
replace: true, | |
scope: {user: '='}, // 后面将会解释为何这么写 | |
templateUrl: "/js/directives/header.html", | |
controller: ['$scope', '$filter', function ($scope, $filter) { | |
// 控制器 | |
}] | |
} | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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