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 true or false is displayed on it The line of code is:

gt; & Lt; / Span & gt;

$ watch This part acts as an alert that says hey, the card type has changed!

How do I change 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

for

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

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -