国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

angular.js - Can controllers in angularjs be nested?
漂亮男人
漂亮男人 2017-05-15 16:49:57
0
5
1101

Can controllers in angularjs be nested?

For example:

<p ng-controller="ACtrl">
    <p ng-controller="BCtrl">
        <p>{{ value }}</p>
    </p>
</p>

Modifying the value of $scope.value in BCtrl and then using inprog in ACtrl seems to cause an error.

漂亮男人
漂亮男人

reply all(5)
洪濤

can be nested, but you should use $parent variables.
http://fdietz.github.io/recipes-with-angular-js/controllers/sharing-models-between-nested-controllers.html

阿神

http://stackoverflow.com/questions/21287794/angularjs-controller-as-syntax-clarification

黃舟

It can be nested, and the syntax of "controller as ctrl" is better. If you think about it written like in the question, you don’t know whether the value comes from ACtrl or BCtrl

<p ng-controller="ACtrl as a">
    <p ng-controller="BCtrl as b">
        <p>{{ b.value }}</p>
    </p>
</p>
給我你的懷抱

It must be nestable, otherwise it will not easily shake the dominance of JQuery. If you really want to learn, I recommend the book Angular Authoritative Guide

阿神

The best book in China at present should be the Chinese version of ng-book. Read the book carefully. It’s much better than the era when you could only read documents through the wall.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template