What is stateProvider in AngularJs

0 votes
Can someone please provide the syntax and Example of it??
Feb 11, 2020 in Angular by kartik
• 37,520 points
2,731 views

1 answer to this question.

0 votes

Routing is just another way of fixing some content dynamically as part of your application.It is a key part of all websites and web applications in one way or another. 

It plays a central role in static HTML pages as well as in the most complex React web applications. Routing comes into play whenever you want to use a URL in your application.

Angular-UI-Router has stateProvider method which is used to create routes/states in application. State Provider takes state name and state configurations as parameters.

Syntax:

$stateProvider
.state('StateName', {
    url: 'Url pattern for this State',
    template: "Html content",
    controller: "Name of the Controller for this state"
});

Instead of template, templateUrl can be used and given the path of the HTML file to render for the state.
Example:

$stateProvider
.state('Home', {
    url: '/home',
    templateUrl: "home.html",
    controller: "HomeCtrl"
});
    answered Feb 11, 2020 by Niroj
    • 82,840 points

    Related Questions In Angular

    0 votes
    1 answer

    What is so different about interpolate in AngularJS?

    hii @kartik, In order to know about what ...READ MORE

    answered Feb 4, 2020 in Angular by Niroj
    • 82,840 points
    1,580 views
    0 votes
    1 answer

    What is Scope Parameter in AngularJS?

    Hey @kartik, Scope Parameter is a collection of ...READ MORE

    answered Feb 5, 2020 in Angular by Niroj
    • 82,840 points
    1,044 views
    0 votes
    1 answer

    What is isolated Scope in AngularJs?

    Hello kartik, As we know Scope is a ...READ MORE

    answered Feb 5, 2020 in Angular by Niroj
    • 82,840 points
    766 views
    0 votes
    1 answer

    What is transclusion in AngularJS?

    Hey, Let me explain you about transclusion from ...READ MORE

    answered Feb 5, 2020 in Angular by Niroj
    • 82,840 points

    edited Feb 5, 2020 by Niroj 858 views
    0 votes
    1 answer

    What are the $route service Events provide in AngularJs?

    hey, $route is used for deep-linking URLs to controllers ...READ MORE

    answered Feb 10, 2020 in Angular by Niroj
    • 82,840 points
    1,058 views
    +11 votes
    13 answers

    Default parameters of XMS and XMX in JVM

    Run this code to see all the ...READ MORE

    answered Nov 13, 2018 in Java by anonymous
    402,630 views
    0 votes
    1 answer

    how to compare two words in java?

    hey,  I think in your code the function ...READ MORE

    answered Aug 8, 2019 in Java by sampriti
    • 1,120 points

    edited Aug 8, 2019 by Kalgi 2,266 views
    0 votes
    1 answer

    How to add items in list at a time?

    Hi Priyanka , I think this code snippet ...READ MORE

    answered Aug 9, 2019 in Java by sampriti
    • 1,120 points
    2,379 views
    0 votes
    1 answer

    What is $watch() and it's use in AngularJS?

    $watch() function is used to watch the ...READ MORE

    answered Feb 3, 2020 in Angular by anonymous
    • 82,840 points
    2,478 views
    0 votes
    1 answer

    What is $parse in Angularjs

    Before we jump into the topic you ...READ MORE

    answered Feb 4, 2020 in Angular by Niroj
    • 82,840 points
    2,533 views
    webinar REGISTER FOR FREE WEBINAR X
    REGISTER NOW
    webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP