$scope.source.specializations.sort(function(a, b) {
var textA = a.specialization.toUpperCase();
var textB = b.specialization.toUpperCase();
return (textA < textB) ? -1 : (textA > textB) ? 1 : 0;
});
Showing posts with label javascript. Show all posts
Showing posts with label javascript. Show all posts
Friday, January 13, 2017
Tuesday, December 13, 2016
could not use chrome tool to break javascript code
you may defined the java script (function) code twice
Thursday, December 8, 2016
JavaScript lint
http://www.javascriptlint.com/
Monday, November 14, 2016
array sort
$scope.partnership.sort(function compare(a, b) { if (parseInt(a.displayOrder) < parseInt(b.displayOrder)) return -1; if (parseInt(a.displayOrder) > parseInt(b.displayOrder)) return 1; return 0; } );
Tuesday, November 8, 2016
Convert array to JSON
http://stackoverflow.com/questions/2295496/convert-array-to-json
http://stackoverflow.com/questions/191881/serializing-to-json-in-jquery
http://stackoverflow.com/questions/191881/serializing-to-json-in-jquery
var myJsonString = JSON.stringify(yourArray);
var jsonArray = JSON.parse(JSON.stringify(pluginArrayArg))
Wednesday, November 2, 2016
move array element
http://stackoverflow.com/questions/5306680/move-an-array-element-from-one-array-position-to-another
Saturday, September 10, 2016
limit number of checkbox checked
http://www.plus2net.com/javascript_tutorial/checkbox-limit.php
Tuesday, July 12, 2016
Count object length
http://stackoverflow.com/questions/1345939/how-do-i-count-a-javascript-objects-attributes
Count object length
Count object length
Object.keys(myObject).length
Thursday, June 2, 2016
add to class using javascript
http://stackoverflow.com/questions/2221160/how-to-change-a-css-class-style-through-javascript
Wednesday, June 1, 2016
JavaScript debug
I figured this out by adding
console print statements to the functions that were added for page callback and
noticed they were continuing to loop. There are only a handful of reasons for a
loop to not terminate and it was pretty easy once the loop was clearly terminal
as defined. So I back traced the loop variable just reading the code and
figured out that it wasn't actually in scope. In the app while looking at the
nodes widget, telling the console to print x showed it was changing, which
meant it wasn't in any scope and was acting at the root level and thus the
reason for the collision.
Friday, April 22, 2016
birth and death of javascript
https://www.destroyallsoftware.com/talks/the-birth-and-death-of-javascript
Tuesday, March 15, 2016
debug javascript
https://developer.chrome.com/devtools/docs/javascript-debugging#breakpoints-dynamic-javascript
http://www.c-sharpcorner.com/UploadFile/3d39b4/debugging-javascript-using-google-chrome/
http://www.c-sharpcorner.com/UploadFile/3d39b4/debugging-javascript-using-google-chrome/
Wednesday, March 2, 2016
debug dynamically loaded JavaScript file
if using vs2015, need to us IE and step into dynmically loaded javascript file, if you do not step into then it will not stop at the breakpoint of the dynamically load JavaScript file.
debug-dynamically-loaded-javascriptwith-jquery-in-the-browsers-debugge
http://stackoverflow.com/questions/9092125/how-to-debug-dynamically-loaded-javascriptwith-jquery-in-the-browsers-debugge
debug-dynamically-loaded-javascriptwith-jquery-in-the-browsers-debugge
http://stackoverflow.com/questions/9092125/how-to-debug-dynamically-loaded-javascriptwith-jquery-in-the-browsers-debugge
ou can give your dynamically loaded script a name so that it shows in the Chrome/Firefox javascript debugger. To do this you place a comment at the end of the script:
//@ sourceURL=filename.js
This file will then show in the "Sources" tab as
filename.js
. In my experience you can use \'s in the name but I get odd behaviour if using /'s.
For more info see: Breakpoints in Dynamic JavaScript
Monday, February 29, 2016
object.defineProperty(cat, 'name', (enumerable: false))
json.stringify(cat);
JavaScript call apply
Call
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/call
var obj = {
num: 2
};
var addToThis = function(a) {
return this.num + a;
};
addToThis.call(obj,3);
the obj is passed to addToThis function which has "num" property. a is passed when call is made.
Apply
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/apply
var addToThis = function(a, b, c) {
return this.num + a + b+ c;
};
console.log(addToThis.apply(obj, arr);
the obj is passed to addToThis function which has "num" property. arguments is passed in an array when apply is made
JavaScript Bind
Ex 1
var a = {name:"bob"};
var b = {name: "john"};
function showName(){return this.name;};
showName.bind(a)();
showName.bind(b)();
Ex 2
function add(x,y){
return x + y;
}
var plus1 = add.bind(null,1);
console.log(plus1(5));
var a = {name:"bob"};
var b = {name: "john"};
function showName(){return this.name;};
showName.bind(a)();
showName.bind(b)();
Ex 2
function add(x,y){
return x + y;
}
var plus1 = add.bind(null,1);
console.log(plus1(5));
Wednesday, February 10, 2016
Prototypal inheritance - page 53 AngualrJS for .Net developers in 24 hours,
Prototypal inheritance is a concept that gives a lot of JavaScript developers problems, especially coming from a classical inheritance background. It’s a vitally important concept, though. To read more about prototypal inheritance, check out the Mozilla Developer Network’s JavaScript Guide. It’s full of great information on JavaScript.
<!-- View without ControllerAs syntax that has nested scopes.-->
<div ng-controller="Order">
<input type="text" ng-model="orderTotal" />
<div ng-if="showDetails">
<input type="text" ng-model="orderTotal" />
</div>
</div>
You can avoid all of that mess by using ControllerAs syntax:
<!-- View with nested scopes, but with ControllerAs.-->
<div ng-controller="Order as vm">
<input type="text" ng-model="vm.orderTotal" />
<div ng-if="showDetails">
<input type="text" ng-model="vm.orderTotal" />
</div>
</div>
Now the two models explicitly share the same scope of the controller’s alias,
<!-- View without ControllerAs syntax that has nested scopes.-->
<div ng-controller="Order">
<input type="text" ng-model="orderTotal" />
<div ng-if="showDetails">
<input type="text" ng-model="orderTotal" />
</div>
</div>
You can avoid all of that mess by using ControllerAs syntax:
<!-- View with nested scopes, but with ControllerAs.-->
<div ng-controller="Order as vm">
<input type="text" ng-model="vm.orderTotal" />
<div ng-if="showDetails">
<input type="text" ng-model="vm.orderTotal" />
</div>
</div>
Now the two models explicitly share the same scope of the controller’s alias,
vm
, and we’ve tamed the scope craziness.
Thursday, January 28, 2016
javascript tutorials
https://www.youtube.com/watch?v=PMsVM7rjupU&list=PL6n9fhu94yhUA99nOsJkKXBqokT3MBK0b
Friday, August 21, 2015
webpack vs browserify
http://mattdesl.svbtle.com/browserify-vs-webpack
Return of false for onkeypress event no longer blocks input
http://forums.asp.net/t/1118932.aspx?Return+of+false+for+onkeypress+event+no+longer+blocks+input
Return of false for onkeypress event no longer blocks input
06-06-2007 01:30 PM|LINK
I did find out how to solve my problem. By changing the onkeypress event from:
onkeypress="return validNumeric(event);" to
onkeypress="event.returnValue=validNumeric(event);"
I now get the form to limit input in the zipcode textbox to numbers only and also keep the DefaultButton property on the Panel it is contained
Subscribe to:
Posts (Atom)