简体   繁体   English

如何在ngModel中包含变量

[英]How to include a variable in ngModel

Because I am using ngInclude to switch different templates, each template contains the same form to call the same functions in the controller. 因为我使用ngInclude来切换不同的模板,所以每个模板都包含相同的形式以调用控制器中的相同功能。 I want to include a defined variable, like a table name, to the ngModel , so I can use it to filter the data in either js code or PHP code, in order to insert the information into the right table. 我想在ngModel包括一个定义的变量,例如表名,因此我可以用它来过滤js代码或PHP代码中的数据,以便将信息插入正确的表中。

I did some researches but did not find any. 我做了一些研究,但没有发现。 Does anyone knows how to do it, or have better idea how to do it? 有谁知道该怎么做,或者有更好的主意该怎么做?

Thank you 谢谢

You can use angular ui-router instead ngInclude for loading html template, then you can pass data as variable 您可以使用angular ui-router代替ngInclude来加载html模板,然后可以将数据作为变量传递

take a look at this https://angular-ui.github.io/ui-router/site/ 看看这个https://angular-ui.github.io/ui-router/site/

抱歉,这是一个愚蠢的问题,我只解决了一个问题,我在Submit函数的参数中添加了一个值,例如ng-click="submit(file, 'poster')" ,然后使用它来处理js代码并PHP代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM