Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Parent scope?
Message
 
 
À
Tous
Information générale
Forum:
Javascript
Catégorie:
Autre
Titre:
Parent scope?
Divers
Thread ID:
01611473
Message ID:
01611473
Vues:
42
Hi everybody,

My form is controlled by AccountController.js and has the following code
accountsService.getAccountBalance($scope.currentAccount.acctNameHash).then(function (data) {
                          $scope.currentAccount.totalBalance = data.balance;                 
                      });
In that form I have two following pages:
<div class="tab-pane" id="invoices" ng-controller="invoicesCrudController">
                              
                                @Html.Partial("../Invoices/EditAccountInvoices")
                            </div>

                            <div class="tab-pane" id="invoicesToBePaid" ng-controller="invoicesToBePaidCrudController">
                               @Html.Partial("../Invoices/PayInvoices")
                            </div>
So, these two pages use different controller and, I assume, different scope.

Now, after I paid invoices I want to reload the total balance which is at the top of my form, e.g.
	@Labels.account : {{ currentAccount.fullName }} {{ !isNew ? '(' + currentAccount.acctName + ')' : '' }} {{ currentAccount.isSystemAccount? '(System Account)' :''}} @Labels.totalDueForAllInvocies: <span ng-class="{'negative-amount': currentAccount.totalBalance < 0}">{{currentAccount.totalBalance| currency}}</span>
My question is: how can I do this from the invoicesToBePaidCrudController that doesn't seem to have access to $scope.currentAccount which is defined in the other controller.

Do you see my problem? How can I signal from one "sub-form" to the main form?

Thanks in advance.

UPDATE. Reading this interesting discussion right now:

http://stackoverflow.com/questions/11252780/whats-the-correct-way-to-communicate-between-controllers-in-angularjs and related links. I used broadcast event.
If it's not broken, fix it until it is.


My Blog
Répondre
Fil
Voir

Click here to load this message in the networking platform