filmov
tv
angularjs ui router configuring states

Показать описание
angularjs ui router stateprovider
$stateprovider example
state provider example in angularjs
stateprovider state example
ui router ui-sref
ui-router ui-sref example
In this video we will discuss configuring states in an angular application. According to angular documentation, a state corresponds to a "place" in the application.
Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our YouTube channel. Hope you can help.
To configure a state use state() method of $stateProvider service
state() method has 2 parameters
i) name - A unique state name, e.g. "home", "courses", "students"
ii) stateConfig - State configuration object
State configuration object has several properties. Some of them are listed below.
template
templateUrl
controller
controllerAs
resolve
url
Let us now configure states for the sample application that we have been working with. We will configure home, courses and students states. Here are the steps
var app = angular
.config(function ($stateProvider) {
$stateProvider
.state("home", {
url: "/home",
controller: "homeController",
controllerAs: "homeCtrl"
})
.state("courses", {
url:"/courses",
controller: "coursesController",
controllerAs: "coursesCtrl"
})
.state("students", {
url:"/students",
controller: "studentsController",
controllerAs: "studentsCtrl",
resolve: {
studentslist: function ($http, $location) {
.then(function (response) {
})
}
}
})
})
.controller("studentsController", function (studentslist, $state, $location) {
var vm = this;
else
}
}
})
[a ui-sref="home"]Home[/a]
[a ui-sref="courses"]Courses[/a]
[a ui-sref="students"]Students[/a]
At this point, home, courses and students links shoud work as expected. The other links are broken. We will discuss fixing these in our upcoming videos.
Link for all dot net and sql server video tutorial playlists
Link for slides, code samples and text version of the video
$stateprovider example
state provider example in angularjs
stateprovider state example
ui router ui-sref
ui-router ui-sref example
In this video we will discuss configuring states in an angular application. According to angular documentation, a state corresponds to a "place" in the application.
Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our YouTube channel. Hope you can help.
To configure a state use state() method of $stateProvider service
state() method has 2 parameters
i) name - A unique state name, e.g. "home", "courses", "students"
ii) stateConfig - State configuration object
State configuration object has several properties. Some of them are listed below.
template
templateUrl
controller
controllerAs
resolve
url
Let us now configure states for the sample application that we have been working with. We will configure home, courses and students states. Here are the steps
var app = angular
.config(function ($stateProvider) {
$stateProvider
.state("home", {
url: "/home",
controller: "homeController",
controllerAs: "homeCtrl"
})
.state("courses", {
url:"/courses",
controller: "coursesController",
controllerAs: "coursesCtrl"
})
.state("students", {
url:"/students",
controller: "studentsController",
controllerAs: "studentsCtrl",
resolve: {
studentslist: function ($http, $location) {
.then(function (response) {
})
}
}
})
})
.controller("studentsController", function (studentslist, $state, $location) {
var vm = this;
else
}
}
})
[a ui-sref="home"]Home[/a]
[a ui-sref="courses"]Courses[/a]
[a ui-sref="students"]Students[/a]
At this point, home, courses and students links shoud work as expected. The other links are broken. We will discuss fixing these in our upcoming videos.
Link for all dot net and sql server video tutorial playlists
Link for slides, code samples and text version of the video
Комментарии