Partial views in AngularJS

前端 未结 1 1458
逝去的感伤
逝去的感伤 2020-12-17 10:46

I\'m new to Angular and would appreciate any advice. Basically, I have one-to-many relationship- one Category has several Product, I have the layo

相关标签:
1条回答
  • 2020-12-17 11:31

    there are couple ways for partials in AngularJS.

    ng-include

    If theres no logic, or it will be provided from parent scope you can just include a html file into your view.

    Example:

    <div ng-include="'/path/to/your/file.html'"></div>
    

    new directive

    If you'll have a bit logic in your partial, and you'd like to use it as a separate module in your app - I'll strongly advice to built a new directive.

    Example.

    PS. If you're new to Angular, this may be useful :-)

    0 讨论(0)
提交回复
热议问题