AngularJS - 如何在Custom指令中重新加载数据

时间:2022-09-26 11:22:27

I have a custom directive..I need to reload the data up on a button click...fetching the data fresh from back-end service and refresh on the screen. can someone help me with getting through this ?

我有一个自定义指令..我需要通过点击按钮重新加载数据...从后端服务获取新数据并在屏幕上刷新。有人可以帮我解决这个问题吗?

1 个解决方案

#1


0  

You can bind local scope/directive property to parent scope property. Here is a simple example that updates contents of directive on button click.

您可以将本地范围/指令属性绑定到父范围属性。这是一个简单的例子,它在按钮点击时更新指令的内容。

http://jsbin.com/dijijonedu/1/edit?html,js,output

http://jsbin.com/dijijonedu/1/edit?html,js,output

#1


0  

You can bind local scope/directive property to parent scope property. Here is a simple example that updates contents of directive on button click.

您可以将本地范围/指令属性绑定到父范围属性。这是一个简单的例子,它在按钮点击时更新指令的内容。

http://jsbin.com/dijijonedu/1/edit?html,js,output

http://jsbin.com/dijijonedu/1/edit?html,js,output