Does $state.go trigger relevant events when transitioning to the current state?

Imagine I am currently in state A, and within this state there is a button with an ng-click event handler like this:

$scope.go = function() {
    $state.go("A");
}

My query is whether the events $stateChangeStart and $stateChangeSuccess are triggered?

Answer №1

Your example will not trigger the <code>$stateChangeStart
and $stateChangeSuccess events.

To see for yourself, here is a plunker link you can visit: http://plnkr.co/edit/MkdO0yuWh6SbZ3mGlecj?p=preview

If you want to make these events happen, make sure to include additional parameters.

$scope.go = function() {
    $state.go("A", {}, {reload: true});
}

Remember that $state.go() is just a shortcut for $state.transitionTo(). You can find more details here: https://github.com/angular-ui/ui-router/blame/legacy/src/state.js#L910-L929

I hope this explanation helps you grasp the basics better.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the best way to send an XML body using Angular 5 with POST method?

I am currently developing an Ionic application that needs to make REST API calls with XML as the body. However, I am facing issues in getting the call to post with XML. This is my LoginProvider where I utilize DOMParser to parse data to XML before sending ...

Achieve a scrolling effect for just a specific section of an HTML page

Hey there! I'm currently working on adding scrolling text along the side of a webpage for a specific section. My goal is to have three different sections, each with text that stops scrolling when you reach it and then transitions to the next section o ...

AngularJS text area not displaying HTML content

In my Ionic's App, I have a textarea that is used for creating or editing messages. However, I am encountering an issue where the textarea does not render HTML tags when trying to edit a message. I attempted solutions such as setting ng-bind-html and ...

What is the most efficient way to implement hiding/showing elements, adding/removing classes, and optimizing code in jQuery?

Looking for a more elegant solution to toggle classes on a div when clicking a button? Current code logic: jQuery(document).ready(function($) { // Removing/adding classes to show/hide div elements on button click // More efficient w ...

Is there any re-rendering optimization feature in Angular 2?

After experimenting with React for a few months, I've noticed that it doesn't just re-render a component entirely. Instead, it identifies the differences and updates only those parts. Does Angular 2 operate in a similar manner? Additionally, whe ...

What is the method for resolving circular references using double closures?

Recently, I came across an article discussing how circular references can lead to memory leaks in internet explorer (IE). The article presented an example involving closures nested within each other to demonstrate how a circular reference could occur: fun ...

405 Error: AJAX call is not permitted

I am currently working on creating a form that will submit a JSON object to an application on a different server, but I am encountering a 405 Method Not Allowed error in the console. The application is configured to accept POST requests, which is exactly ...

Is it possible to make any object reactive within Vuex?

Seeking ways to enhance the sorting of normalized objects based on a relationship. Imagine having an application that requires organizing data in a Vuex store containing multiple normalized objects, like this: state: { worms: { 3: { id: 3, na ...

What is the process for incorporating personalized field attributes using an inlineformset_factory in Django?

I am currently working with an 'inlineformset_factory' and I am trying to determine the best way to set attributes for the individual fields. So far, I have not been able to find a method to add them without resorting to using javascript, which i ...

Using Selenium WebDriver with JavaScript: Handling Mouse Events (mouseover, click, keyup) in Selenium WebDriver

I am currently working on integrating Selenium testing for mouse events with dynamically generated elements. Specifically, I am attempting to trigger a "mouseover" event on an element and then interact with some icons within it. However, I have encountere ...

Tips for creating a consistent header and footer across an HTML CSS web application

My previous projects involved using ASP.NET MVC and utilizing @Html.Partial("_header") to incorporate common static HTML across different pages. However, my current project is a pure HTML CSS and JS web app with no server-side technology. The la ...

The footer seems to be losing its stickiness and not staying at the bottom when I

My goal is to create a sticky footer for my webpage. Once you click the add new sports button, a drawer slides out and the footer remains fixed at the bottom. However, as I scroll down the page, the footer moves up instead of staying in place. I have tried ...

Encountering a JS error while attempting to execute a basic HTTP request

I'm currently attempting to interact with a Gateway and decided to test out the https://www.npmjs.com/package/@types/request module. Below is the snippet of code I am trying to execute: export class OAuthAccessor { //some stuff public stat ...

Issue encountered while initializing an HtmlPage with HTMLUnit

When attempting to execute the following code: try (final WebClient webClient = new WebClient(BrowserVersion.FIREFOX_45)) { webClient.getOptions().setJavaScriptEnabled(true); final HtmlPage page = webClient.getPage("http://www.chem ...

Initiating a SOAP WSDL request

Looking to create a Request for Comment (RFC) using a SAP function. A SAP data source was generated from this function. Upon visiting the following address: , a page with XML definitions is displayed. <?xml version="1.0" encoding="UTF-8&q ...

Require the field if the country selected is the United States

I am working on implementing form validation for the STATES dropdown, but I want it to only be required if the selected country is USA or CANADA. Currently, my validation works regardless of the country selection. It forces the user to select a state even ...

Testing the data URLs of cookies in Selenium using JavaScript

Currently, I have a Behat test that runs Selenium whenever Javascript is required. The test works perfectly fine if Javascript is disabled. However, the error feedback I receive from Selenium is the following: unknown: Failed to set the 'cookie&apo ...

JavaScript Bug Report

Currently, I am immersed in a project that encompasses various languages like HTML, JS, and PHP. While working on one of the PHP functions, I stumbled upon an unexpected anomaly. To dissect it better, I decided to break it down into simpler functions: &l ...

What happens to an array element when it becomes null within the realm of JavaScript?

As I work on a complex AJAX control class, I've encountered an interesting question. For instance, imagine I store all page elements in an array upon initialization. When a user triggers an AJAX-enabled link, specific parts of the content are replac ...

"Utilize an Ajax form with the 'post' method

I'm facing an issue with the AJAX form as it keeps throwing an error. I really need it to function properly when a button is clicked, refreshing all data in the process. <form name="form" id="form" class="form"> ...