search

Home  >  Q&A  >  body text

angular.js - Angular template reuse

The function I want to implement is as shown in the picture above, with the list on the left and the properties panel in the upper right corner. There may be the same list items in the list. If they are the same list items, then their property panels are also the same. I'm using ng-include to load the templates for these property panels. Question: For example, the first three items are the same list items and correspond to the same template, which means they correspond to a controller. In this case, their data is shared, how to achieve separation? View shared, model separated
黄舟黄舟2758 days ago493

reply all(1)I'll reply

  • 某草草

    某草草2017-05-15 17:03:42

    Similar to components in ReactJS, they are implemented using directives in Angularjs. Templates can be set inside the components. After defining the directives, they can be used anywhere, just like Component in ReactJS!

    https://docs.angularjs.org/guide/directive

    reply
    0
  • Cancelreply