angularjs - How would I share scope between an angular controller and a directive -
I am trying to do something like that.
What do I expect to happen that a selected list is displayed and when the option is selected, the word How do I change for true or
false is displayed on it The line of code is:
$ watch This part acts as an alert that says
hey, the card type has changed!
directive ?
.controler ('AddCreditCardChargeCtrl', ['$ scope', function ($ scope) {$ scope.creditCards = [{name: 'MISC' name: 'Mastercard credit' Value: 'VIS', Transaction: 'VIS', Value: 'MSC', 'Visa Debit / DLTA' (name: 'MAESTRO', Value: 'MAE', Transaction: FI: Incorrect}, {Name: 'SWITCH ',': Transaction: Sender: Correct}, {Name: 'MasterCard Debit', Value: 'MCD', Transaction FI: Incorrect} Value: 'SWI', Transaction Eph: Incorrect}, {name: 'Visa Electron' , Value: 'ELC', transaction FI: false}, {name: 'solo', value : 'SOL', transaction FI: false}] $ scope.selectAction = function {warning ($ scope.creditCardModel); Warning (hasTransFee ($ scope.creditCardModel); $ Scope.cardType = hasTransFee ($ scope. CreditCardModel); // console.log (cardType.name) // console.log (cardType.transactionFee) console.log ('clock') $ radius. $ Watch ("cardType.transactionFee", function () {warnings (' Hey, the card type has changed! ');});} Var hasTransFee = function (cardtype) {for (var i = 0; i
scope: false , so there is no new possibility, in this way you will share the share with the controller
Note
edit:
link Try without using Hnkshn to
. Directive ('bhtDiscountPrice', ['BasketFactory', function (basketball) {return {restrict: 'EA', radius: correct, template: '& lt; span data-ng-bind = "cardType.transactionFee" & Gt; & Lt; / span & gt; '};});
Comments
Post a Comment