0

Can you guys explain how the flow works when url get hit? and why angular template url not working?

The question is when the url clicked on the browser, it might go to the cache for URL saved from $stateprovider.state and then might go to find the file as I defined like below, and then where does it go ? if they need to they might go to asp.net core controller to fetch data. Am I understanding right?

The problem I am having is .. TemplateUrl is not pointing to the folder in the file . I tested it with another file in a different folder but it works fine other than this file.

$stateProvider.state("users.index", {
    url: "/",
    templateUrl: "/users/index",
    //template:'<p>test</p>',
    controller: "userController",
    resolve: {
        viewModel: ["userService", function (userService) {
            return userService.getAllUsers();
        }]
    }
});
1
  • Check the network tab to of the Developer Console to see any errors. Make sure that the <base> tag is set properly. Are you using HTML5 mode? Commented Mar 5, 2020 at 23:15

1 Answer 1

1

After Angular UI Router determines the correct state to activate from the URL, it gets the templateUrl value for that state.

First, it checks the $templateCache service to see if it has an entry for /users/index. If it does, it uses it and is done.

If not, it uses the $templateRequest service to request that URL from the server. Since I don't know how your server is configured, I don't know what will be returned by that URL.

Hopefully that helps you get a bit further in figuring this out.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.