filmov
tv
AngularJS ui router nested views

Показать описание
ui-router nested views tutorial
angularjs ui-router nested states
angularjs nested states example
angular ui router nested views example
ui-router parent child state
angularjs ui router parent child state
angularjs ui router nested resolve
ui router nested views resolve
In this video we will discuss nested states and views.
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.
One of the benefits of ui-router over ngRoute is that it provides support for nested states and views. Nested states have parent child relationship. This means properties of the parent state are available to the child state. There are several methods for nesting states. The following are the 2 common methods.
.state("studentParent", {
// parent state config properties
})
// child state config properties
})
2. Using the parent property with the parent name as string. In the example below, we are using parent property in the child state to specify who the parent is for this state.
.state("studentParent", {
// parent state config properties
})
.state("students", {
parent: "studentParent",
// child state config properties
})
Let us understand nested states and views with an example. Here is what we want to do. On the students and studentDetails pages, we want to display student totals i.e the total number of male students, female students and grand total at the top of the pages in addition to the data these pages are already displaying.
Step 1 : Create a studentTotals class. We will use this class as a container for student totals.
namespace Demo
{
public class studentTotals
{
public int total { get; set; }
public int males { get; set; }
public int females { get; set; }
}
}
[WebMethod]
public void GetStudentTotals()
{
studentTotals totals = new studentTotals();
string cs = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;
using (SqlConnection con = new SqlConnection(cs))
{
SqlCommand cmd = new SqlCommand("SELECT COALESCE(Gender, 'GrandTotal') AS Gender, COUNT(*) AS Total FROM tblStudents GROUP BY ROLLUP(Gender)", con);
con.Open();
SqlDataReader rdr = cmd.ExecuteReader();
while (rdr.Read())
{
switch(rdr["Gender"].ToString())
{
case "Male" :
break;
case "Female":
break;
default:
break;
}
}
}
JavaScriptSerializer js = new JavaScriptSerializer();
Context.Response.Write(js.Serialize(totals));
}
.state("studentParent", {
url: "/students",
controller: "studentParentController",
controllerAs: "stdParentCtrl",
resolve: {
studentTotals: function ($http) {
.then(function (response) {
})
}
},
abstract: true
})
Link for all dot net and sql server video tutorial playlists
Link for slides, code samples and text version of the video
angularjs ui-router nested states
angularjs nested states example
angular ui router nested views example
ui-router parent child state
angularjs ui router parent child state
angularjs ui router nested resolve
ui router nested views resolve
In this video we will discuss nested states and views.
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.
One of the benefits of ui-router over ngRoute is that it provides support for nested states and views. Nested states have parent child relationship. This means properties of the parent state are available to the child state. There are several methods for nesting states. The following are the 2 common methods.
.state("studentParent", {
// parent state config properties
})
// child state config properties
})
2. Using the parent property with the parent name as string. In the example below, we are using parent property in the child state to specify who the parent is for this state.
.state("studentParent", {
// parent state config properties
})
.state("students", {
parent: "studentParent",
// child state config properties
})
Let us understand nested states and views with an example. Here is what we want to do. On the students and studentDetails pages, we want to display student totals i.e the total number of male students, female students and grand total at the top of the pages in addition to the data these pages are already displaying.
Step 1 : Create a studentTotals class. We will use this class as a container for student totals.
namespace Demo
{
public class studentTotals
{
public int total { get; set; }
public int males { get; set; }
public int females { get; set; }
}
}
[WebMethod]
public void GetStudentTotals()
{
studentTotals totals = new studentTotals();
string cs = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;
using (SqlConnection con = new SqlConnection(cs))
{
SqlCommand cmd = new SqlCommand("SELECT COALESCE(Gender, 'GrandTotal') AS Gender, COUNT(*) AS Total FROM tblStudents GROUP BY ROLLUP(Gender)", con);
con.Open();
SqlDataReader rdr = cmd.ExecuteReader();
while (rdr.Read())
{
switch(rdr["Gender"].ToString())
{
case "Male" :
break;
case "Female":
break;
default:
break;
}
}
}
JavaScriptSerializer js = new JavaScriptSerializer();
Context.Response.Write(js.Serialize(totals));
}
.state("studentParent", {
url: "/students",
controller: "studentParentController",
controllerAs: "stdParentCtrl",
resolve: {
studentTotals: function ($http) {
.then(function (response) {
})
}
},
abstract: true
})
Link for all dot net and sql server video tutorial playlists
Link for slides, code samples and text version of the video
Комментарии