Use and implementation of NG-Include instructions in Angular.js

Preface

Everyone wants to load a content dynamically in AngularJS, then we can use ng-incrude to implement. Today Insus.net is in an ASP.NET MVC environment, and an example to demonstrate its function.

Example introduction

You can dynamically load any other view dynamically in one view. If your dynamic content has many parts, you have to need to create a corresponding Action operation in the controller, such as using some Partial View does not have to create a corresponding action. So this is INSUS.NET like it.

In addition, we also need to bring some parameters for NG-INCLUDE links! ! !

Therefore, the parameter is implemented using Model:

Due to the link of Ng-Include, the view is directly directly to the partial view name or path. Render partial view. Angular.Js中ng-include指令的使用与实现

We think of a way, write a public view, all of which are loaded in this public view, using this public view to render these partial views.

In the CommonView operation action, we are incoming a model, which is prepared for later delivery parameters.

Angular.Js中ng-include指令的使用与实现 Next, I wrote this view:

The Action of the rendering part of the view is created. It does not have too much HTML code.

Create 2 partial views, of course, in the actual environment, maybe more than 2.

Part of view_View1: Angular.Js中ng-include指令的使用与实现

Partial view 2:

Everything is ready for all the NG-Include: Angular.Js中ng-include指令的使用与实现

Angular.Js中ng-include指令的使用与实现
Summary

The above is the full content of this article. I hope that the content of this article will bring some help to everyone or use Angular.js. If you have any questions, you can leave a message, thank you for your support of Tumi Cloud.

Angular.Js中ng-include指令的使用与实现

© Copyright Notice
THE END
Just support it if you like
like0
share
comment Grab the couch

Please log in to comment