当div可见时再次调用指令

时间:2016-12-23 10:07:49

标签: angularjs

我有以下要求。 当页面加载时,model.isValidUserType()为false,因此我的div不可见但是指令' my-directive'被叫。 但是用户做了一些动作并且model.isValidUserType()返回true并且我的div是可见的。但是这里我的指令没有被调用。

那么如何再次调用my-directive我的div是可见的。

<div ng-show="model.isValidUserType() ===true">
    <div>
        <section class="abc" apply-check id='home'>
            <progress-card></progress-card>
        </section>
    </div>


</div>

我不能使用ng-if,因为它在某些其他条件下失败了。任何其他方法来解决它。?

2 个答案:

答案 0 :(得分:0)

替换<div ng-show="model.isValidUserType() ===true">

<div ng-if="model.isValidUserType() ===true">

答案 1 :(得分:0)

您需要使用ng-if代替ng-show。

<div ng-if="model.isValidUserType() ===true">
<div>
    <section class="abc" apply-check id='home'>
        <progress-card></progress-card>
    </section>
</div>