AngularJS optional url parameters

preview_player
Показать описание
angular optional route parameter
angular route param optional
angularjs optional route parameter
angularjs route optional parameters
angularjs routeparams optional
angular optional parameter
angular optional params
angular optional parameter example in c#
angular route params optional

AngularJS optional url parameters

In this video we will discuss angular optional URL parameters. Let us understand this with an example. Here is what we want to do.

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.

On the list of students page, we want to search employees by name.

For example if we type "Ma" and click search button, on the subsequent page we want to display all the student names that start with "Ma"

Here are the steps to achieve this.

[WebMethod]
public void GetStudentsByName(string name)
{
List[Student] listStudents = new List[Student]();

string cs = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;
using (SqlConnection con = new SqlConnection(cs))
{
SqlCommand cmd = new SqlCommand("Select * from tblStudents where name like @name", con);
SqlParameter param = new SqlParameter()
{
Value = name + "%"
};
cmd.Parameters.Add(param);

con.Open();
SqlDataReader rdr = cmd.ExecuteReader();
while (rdr.Read())
{
Student student = new Student();
listStudents.Add(student);
}
}

JavaScriptSerializer js = new JavaScriptSerializer();
Context.Response.Write(js.Serialize(listStudents));
}

.controller("studentsController", function ($http, $route, $location) {
var vm = this;

else
}

}

.then(function (response) {
})
})

[h1]List of Students[/h1]

[ul]
[/a]
[/li]
[/ul]

.controller("studentsSearchController", function ($http, $routeParams) {
var vm = this;

$http({
method: "get",
}).then(function (response) {
})
}
else {
.then(function (response) {
})
}
})

.when("/studentsSearch/:name?", {
controller: "studentsSearchController",
controllerAs: "studentsSearchCtrl"
})

Link for all dot net and sql server video tutorial playlists

Link for slides, code samples and text version of the video
Рекомендации по теме
Комментарии
Автор

Venkat Sir,
Your gift of education to all of us is priceless. Thanks a lot.

uday
Автор

Please share the video to all of your programmer friends and give like to this video.

raqibul
Автор

Sir Add some updated video in C# 6.0 feature and Mvc 5.0 additional feature.

saktiprasadswain
Автор

Your Tutorials are so helpful to the beginners ... Thanks a lot Venkat!

persistencej
Автор

Could you please create series on Task Parallel Library

PranjalPathakji
Автор

Nice video as always. I want to ask something: why don't you use LINQ instead of all this code? Any specific thing?

rafaelsantana
Автор

Great series... Waiting for more videos in this course :)

atifrehman
Автор

Why can't we reuse Students details.html page instead of creating new students search .html ?

SimpleLife
Автор

hi sir,
why can't we use same controller for all views....what is the need for separate controller for each partial views .
Thanks in advance

nandhinibaskaran
Автор

y we are making a database connection for getting the name... there is nothing in the frontend for filtering ?

deepasingh
Автор

If possible upload angular js security videos.

madhavikundurthi
Автор

Could you please help me with how to pass two optional parameter via url? Thanks.

sushmitagoswami
Автор

Suppose if the search results are in the same HTML. but I need different url after search results?? what is the solution

navaneethreddy
Автор

how $routeParams.name works ? Please explain ..

ej
Автор

Can i use this Web API for practise ??
can you give me a link ??

niravpatel
Автор

your a lots of angularjs video connected with sql and asp.net. so its is prerequirment to understand sql and asp, net to understand your angularjs.

coolNotCold