Please looking related post for AngularJs related post under the "Related Post" section.
Hope you like those posts and please keep reading blog.
Please give your suggestions and comments for blog improvement.
Kalpesh Satasiya
12:48 PM
.CS class, asp.net, Asp.Net 5, asp.net MVC 6, Enum to HashTable
No comments
Kalpesh Satasiya
11:37 AM
jquery, OnKeyPress event, textarea
No comments
Here we have one textarea and define id as txtcomment. so I am going to attached keypress event for textarea.
function restrictLenght()
{
var tval = $('#txtcomment').val(),
return tval.length < 250;
}
Kalpesh Satasiya
3:31 PM
AngularJs, AngularJs Factory, AngularJs Provider, AngularJs Services, tech-coder.com
No comments
Kalpesh Satasiya
2:46 PM
asp.net, C#, tech-coder.com
No comments
Convert.ToString() handles null, while ToString() doesn't.
Kalpesh Satasiya
7:02 PM
Other, software developer, software development, tech-coder.com
No comments
Kalpesh Satasiya
3:55 PM
.CS class, asp.net, GridView, Header
No comments
if (dt.rows.count > 0)
{
grdview.DataSource = dt;
grdview.DataBind();
}
else
{
var dummyTable = new DataTable();
dummyTable.Columns.Add("Column1");
dummyTable.Columns.Add("Column2");
dummyTable.Rows.Add(dummyTable.NewRow());
grdview.DataSource = dummyTable;
grdview.DataBind();
grdview.Rows[0].Style.Add(HtmlTextWriterStyle.Display, "none");
}
Hope you would like it and please share your suggestions and comments for improvement.
Kalpesh Satasiya
1:37 PM
AngularJs, Dependency Annonation, Dependency Injection
1 comment
//define a module
var mainApp = angular.module("mainApp", []);
mainApp.controller('MathsFunController', ['$scope', 'mathService', function($scope, mathService) {
// ...
}]);
Here we pass an array whose elements consist of a list of strings (the names of the dependencies) followed by the function itself.//define a module
var mainApp = angular.module("mainApp", []);
var MathsFunController = function($scope, mathService) {
// ...
}
MathsFunController.$inject = ['$scope', 'mathService'];
mainApp.controller('MathsFunController', MathsFunController);
Implicit Annotation
Careful: If you plan to minify your code, your service names will get renamed and break your app.The is the simplest way to inject the dependencies because of dependencies is to assume that the function parameter names are the names of the dependencies.
//define a module
var mainApp = angular.module("mainApp", []);
mainApp.controller('MathsFunController', function($scope, mathService{
// ...
});
Above a function, the injector can refer the names of the servies to inject at function declaration and extracting the parameter names.
Kalpesh Satasiya
10:51 AM
AngularJs, AngularJs Component, Dependency Injection
1 comment
//define a module
var mainApp = angular.module("mainApp", []);
//create a value object as "defaultValue" and pass it a value.
mainApp.value("defaultValue", 5);
//inject the value in the controller using its name "defaultValue"
mainApp.controller('MathsFunController', function($scope, defaultValue) {
$scope.number = defaultValue;
});
Factory//define a module
var mainApp = angular.module("mainApp", []);
//create a factory "MultiplyService" which provides a method multiply to return multiplication of two numbers
mainApp.factory('MultiplyService', function() {
var factory = {};
factory.multiply = function(a, b) {
return a * b
}
return factory;
});
//inject the factory "MultiplyService" in a service to utilize the multiply method of factory.
mainApp.service('MathService', function(MultiplyService){
this.square = function(a) {
return MultiplyService.multiply(a,a);
}
});
//define a module
var mainApp = angular.module("mainApp", []);
//create a service which defines a method square to return square of a number.
mainApp.service('MathService', function(MultiplyService){
this.square = function(a) {
return MultiplyService.multiply(a,a);
}
});
//inject the service "MathService" into the controller
mainApp.controller('MathsFunController', function($scope, MathService, defaultValue) {
$scope.number = defaultValue;
$scope.result = MathService.square($scope.number);
$scope.square = function() {
$scope.result = MathService.square($scope.number);
}
});
//define a module
var mainApp = angular.module("mainApp", []);
//create a service using provider which defines a method square to return square of a number.
mainApp.config(function($provide) {
$provide.provider('MultiplyService', function() {
this.$get = function() {
var factory = {};
factory.multiply = function(a, b) {
return a * b;
}
return factory;
};
});
});
mainApp.constant("configParam", "constant value");
Kalpesh Satasiya
10:38 AM
AngularJs, jquery, jquery plugins, Node.js
No comments
Kalpesh Satasiya
10:27 AM
Golang Configure, Golang installation, IDE, IntelliJ IDEA Configure, Other, Setup Golang
No comments
Kalpesh Satasiya
9:24 AM
AngularJs, Attributes, Custom Directives, Elements.
No comments
<div custom-directives></div>
<div class="custom-directives : expression;"></div>3) As an element: (Restrict option : 'E')
<custom-directive></custom-directive>4) As a comment: (Restrict option : 'M')
< !--directive: custom-directive expression -->So let's time to go through some example's
<div ng-customdirective></div>
Kalpesh Satasiya
11:12 PM
Asp.Net 5, C# 6.0, Dictionary Initializing, String Indexer
No comments
Kalpesh Satasiya
11:01 PM
asp.net, C# 6.0, Microsoft
No comments
Check about example, we have two property "Name" and "City". So in classic way we need to assign property value during object initialization it means under constructor.public class TestClass { public string Name { get; set; } public string City { get; set; } public TestClass() { //Assign value to property Name = "Kalpesh"; City = "Ahmedabad"; } }
public class TestClass { public string Name { get; } = "Kalpesh"; public string City { get; set; } = "Ahmedabad"; }
Kalpesh Satasiya
10:51 AM
Columnstore index, Sql server 2012, Sql server 2014
No comments
Kalpesh Satasiya
11:05 PM
Editor, JavaScript, Visual Studio 2015
No comments
Kalpesh Satasiya
11:00 PM
NopCommerce, Theme, Theme Integration
No comments
Kalpesh Satasiya
10:11 PM
Sql server feature, TRY_CONVERT()
1 comment
Kalpesh Satasiya
11:04 PM
Paging, sql query, Sql server 2012
No comments
Kalpesh Satasiya
8:49 PM
Asp.Net 5, NuGet Packages
No comments