AngularJS - How to reload data in Custom directive - html

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 ?

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

Related

HTML form is getting hanged/Freezes when i try to do any action on screen in Angular 7

Hi my angular form is getting hanged when am try to scroll up and down and try to select drop down options, selecting items in list control. My form contains input controls which has regex patterns, controls. All these controls are in my child html form.
And if i clear cache its working fine.
Please suggest me to fix this issue.
Calling a method function from direct html can be costlier Operation which might have called your application function multiple times apart of life cycle hooks.
It's better to use always variable instead of functions if you are not using it already. Please share your code snippet or stackblitz url for better help from community

Can't set step property in input type number iside alert

I have an input type number inside an Ionic v4 alert, the problem is that I can't set step property since It's not recognised, is there any workaround or solution?
If you have advanced alert needs you might consider making a modal form instead.
The alert doesn't have many configuration options.
I don't see the value in trying to recreate a full modal tutorial here. This seems to cover it quite well.
But the high level overview is that instead of using an alert you create what is basically a new page, but it is loaded in on top of the existing page and you can pass data in and out of it.

Refresh Konva Stage

I am using Konva JS, which will have lots of elements added on stage which will be added on different user actions. Sometime I need to destroy this elements on certain user action. My code is working fine, it's destroying the required element, but not from UI. On next user action it will automatically removed from screen/UI. My elements(a rect and a img)are wrapped inside a group , and I am trying to destroy this group.
So I think my issue is : Stage/Layer is not getting refreshed on "Destroy".
Thanks in advance
If you are using Konva JS over ReactJS framework, make sure to retrieve the right list of object before rendering. To delete a node, delete it from state by resetting a new value without the node to delete, so that the view will be automatically rerendered.

How to bind a angular ng-click event on after lnserted HTML

I am developing rails application where angularjs use in it.
I am facing one problem which i can't understand. Angularjs works fine in all events but i have one module where new html load after page scroll and one another where push new html into existing html on page.
On new html inserted in page, one button in new html where i would like to ng-click event bind with it so when user click on that button i want to procedure.
I tried it but not getting how to bind with button because on loaded html bind easily but in new html not bind.
How to bind on that new HTML button?
Any one have a idea?
Thanks
You need to compile the html in order to get the binds.
Inject $compile in your controller and:
var cHtml = $compile("<button ng-click='doSomething()'>Click me!</button>")($scope);
Then you can add that html using element.append() or jquery

jQuery tab content loaded from PartialView using Ajax

I am loading 2 jQuery UI tabs with data from ASP.NET MVC 3 PartialView using $.ajax(). I am specifying the '/controller/action' as URL. This works fine and I am able to load the two tabs with content returned by the partial views.
I have a Save button in the _layout.cshtml.On clicking the Save button, I want to get data from all tabs and send it to the controller as a JSON object.I want to use only one Save button for saving all data in the tabs instead of having Save button at the bottom of each tab.
The problem is I am able to get data from only the first tab. I get 'No Source Available' error when I try to get data from the other tab. The $('#some_id').change() event is also not fired for the controls in the second tab.
Please suggest if there is a better way to implement this ?
I would also like to know why the HTML generated by PartialView is not seen when I view source HTML of the page ?
Thanks.
It turned out to be an issue of async requests that were being made to load the tabs. I used the load() of jQuery tabs to resolve this.