anchor.diff:    structural directives like `ngFor` and `ngIf` and we
     wrote our own structural directive, `myUnless`, to do something similar.
   
  +  我们学会了通过像`ngFor`和`ngIf`这样的结构型指令来操纵HTML的布局。我们还写出了我们的第一个结构型指令`myUnless`来做类似的事情。
  +
     Angular offers more sophisticated techniques for managing layout
     such as *structural components* that can take external content
     and incorporate that content within their own templates.
     Tab and tab pane controls are good examples.
   
  +  Angular提供了更多成熟的技术来管理布局，比如*结构性组件*可以接受外部内容，并把这些内容合并到组件自己的模板中。
  +  多页标签及其面板控件就是很好的例子。
  +
     We'll learn about structural components in a future chapter.
  +
  +  我们将在未来的章节中学到结构型指令。
  
positive.code:   Now we add it to the `directives`array of the host component and try it.
    First we add some test HTML to the template:
  
  +makeExample('structural-directives/ts/app/structural-directives.component.html', 'myUnless')(format=".")
  :marked
    We run it and it behaves as expected, doing the opposite of `ngIf`.
    When `condition` is `true`, the top paragraph is removed (replaced by `<script>` tags) and the bottom paragraph appears.
  figure.image-display
    img(src='/resources/images/devguide/structural-directives/myUnless-is-true.png' alt="myUnless is true" )
  
  :marked
    Our `myUnless` directive is dead simple. Surely we left something out.
    Surely `ngIf` is more complex?
  
    [Look at the source code](https://github.com/angular/angular/blob/master/modules/%40angular/common/src/directives/ng_if.ts).
    It's well documented and we shouldn't be shy
    about consulting the source when we want to know how something works.
  
    `ngIf` isn't much different! There are a few
    additional checks to improve performance (don't clear or recreate the
    view unless necessary) but otherwise it's much the same.
  
  .l-main-section
  :marked
    ## Wrap up
    Here is the pertinent source for this chapter.
  
  +makeTabs(`
    structural-directives/ts/app/unless.directive.ts,
  
negative.code:   using the built-in `ngOnInit` and `ngOnDestroy` [lifecycle hooks](lifecycle-hooks.html).
    Here it is in action:
  
    借助内建的`ngOnInit`和`ngOnDestroy`[生命周期钩子](lifecycle-hooks.html)，我们还能记录到组件的创建或销毁过程。
    下面是它的操作效果：
  
  figure.image-display
    img(src='/resources/images/devguide/structural-directives/heavy-loader-toggle.gif' alt="heavy loader toggle")
  
  