I want to show Components in a tabs , so first of all create few components. In this project we have three components, First View Component public class AllViewComponent : ViewComponent { private readonly UserManager<ApplicationUser> _userManager; public AllViewComponent(UserManager<ApplicationUser> userManager) { _userManager = userManager; } public async Task<IViewComponentResult> InvokeAsync() { List<StudentViewModel> allUsers = new List<StudentViewModel>(); var items = await _userManager.Users.ToListAsync(); foreach (var item in items) { allUsers.Add(new StudentViewModel {Id=item.Id, EnrollmentNo = item.EnrollmentNo, FatherName = item.FatherName, Name = item.Name, Age = item.Age, Birthdate = item.Birthdate, Address = item.Address, Gender = item.Gender, Email = item.Email }); }
In this article, I will show you, How to open new browser tab using ng-click event. This is the same thing in JQuery. In this example, first of all access division tag using angular,module function. In this we have ng-app as parameter. Lets see the example.
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.9/angular.min.js"></script>
<script type="text/javascript">
var app = angular.module('FirstApp', [])
app.controller('ControllerPage', function ($scope, $window) {
$scope.NewTab = function () {
$window.open("https://dotprogramming.blogspot.com");
}
});
</script>
<div ng-app="FirstApp" ng-controller="ControllerPage">
<input type="button" value="New Tab" ng-click="NewTab()" />
</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.9/angular.min.js"></script>
<script type="text/javascript">
var app = angular.module('FirstApp', [])
app.controller('ControllerPage', function ($scope, $window) {
$scope.NewTab = function () {
$window.open("https://dotprogramming.blogspot.com");
}
});
</script>
<div ng-app="FirstApp" ng-controller="ControllerPage">
<input type="button" value="New Tab" ng-click="NewTab()" />
</div>
</body>
</html>
Comments
Post a Comment