search

Home  >  Q&A  >  body text

angular.js - AngularJs directive isolation scope problem. How to map the variable corresponding to a certain attr

Suppose there is:
$scope.myData = "some data";

The customized directive is like this
<my-directive data-source="myData"></my-directive>

What should I do if I want to get the data of $scope.myData in the directive (data-soucre is a variable parameter, but the form is uncertain. If necessary, it can also be written as scope.myData or the like)

How to write scope mapping

淡淡烟草味淡淡烟草味2838 days ago625

reply all(2)I'll reply

  • 高洛峰

    高洛峰2017-05-15 16:59:11

    Use @

    in diecrive

    reply
    0
  • PHP中文网

    PHP中文网2017-05-15 16:59:11

    Already solved, just use property: =attr

    reply
    0
  • Cancelreply