javascript-framework

How to access this function in my object?

霸气de小男生 提交于 2020-01-15 11:39:08
问题 I have a function object: var myObj=function(){ }; myObj.prototype = { availableColor: function(i){ return "red_"+i; } getColor: function(){ var c = availableColor('3'); //Error: availableColor is not a function ... } } When I call availableColor(i) inside getColor() function, I got error availableColor is not a function .... I also tried to use var c = this.availableColor('3'); and var self=this in the constructor, then var c = self.availableColor('3'); But, none of these help. what is the

Why am I obtaining this error trying to bind the properties from an Angular parent component to a child component?

爷,独闯天下 提交于 2020-01-15 10:37:28
问题 I am very new in Angular and I am finding some dificulties trying to add a component and use it into a project on which I am working on. I have a parent component view that contains thE referenceS to 2 child components, these one (used to show two different sidebar made using PrimeNG but I think taht it is not important): <mail-detail-sidebar *ngIf="visibleSidebar" [selectedMail]="selectedMail" [visibleSidebar]="visibleSidebar" (visibleSidebarEmitter)="visibleSidebarEmitter($event)"> </mail

Custom Javascript EventManager - please help me complete

浪子不回头ぞ 提交于 2020-01-15 04:54:06
问题 I am trying to create a custom javascript EventManager class. I've adopted the format Grant Skinner uses in his easel.js framework for creating the class and need to stick with it. I'm really just lost at this point - I think that - at least in a conceptual sense - I have the right idea here and that it's mostly scope issues that evade me. I'm hoping someone here can help me take this to the point where addListener and dispatchEvent are functional. [code] (function(window) { var EventManager

How can I find the index of an object inside a Array using underscore.js?

情到浓时终转凉″ 提交于 2020-01-12 07:18:22
问题 I want to get the index of the given value inside a Array using underscore.js. Here is my case var array = [{'id': 1, 'name': 'xxx'}, {'id': 2, 'name': 'yyy'}, {'id': 3, 'name': 'zzz'}]; var searchValue = {'id': 1, 'name': 'xxx'}; I used the following code, var index = _.indexOf(array, function(data) { alert(data.toSource()); //For testing purpose return data === searchValue; }); Also tried this too var index = _.indexOf(array, {id: searchValue.id}); But it returns -1 . Since it does not

jQuery/Javascript framework efficiency

纵饮孤独 提交于 2020-01-11 07:23:31
问题 My latest project is using a javascript framework (jQuery), along with some plugins (validation, jquery-ui, datepicker, facebox, ...) to help make a modern web application. I am now finding pages loading slower than I am used to. After some js profiling (thanks VS2010!), it seems a lot of the time is taken processing inside the framework. Now I understand the more complex the ui tools, the more processing needs to be done. The project is not yet at a large stage and I think would be average

jQueryUI Progress Bar

强颜欢笑 提交于 2020-01-06 12:29:04
问题 I have never used the jQuery UI progress bar, but I'd like to make a function that would basically load the jQuery UI progress bar, run it for 5 seconds and then execute another function. ie. function test() { show the jQuery UI progress bar for 5 seconds in div ("progressbar") after 5 seconds has passed..... execute test2() } How can this be done? 回答1: You can do it like this: ​<button onclick="test()">Test</button> <div id="progress"></div>​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​ With animation:

SmartClient: How to use modal window

天涯浪子 提交于 2020-01-06 08:42:04
问题 I want to develop an application in SmartClient using javascript. In that application, it takes inputs like price range and category. On form submit, without reloading the page it will send request to server and will get the list of items.few of them will be displayed after submit(on step 2) and other will be displayed on 3rd step. And there will be a database query fired after step-2 and step-3 Structure to display items details contains item_pic, Item_name, item_price and availability. How

SmartClient: How to use modal window

帅比萌擦擦* 提交于 2020-01-06 08:41:09
问题 I want to develop an application in SmartClient using javascript. In that application, it takes inputs like price range and category. On form submit, without reloading the page it will send request to server and will get the list of items.few of them will be displayed after submit(on step 2) and other will be displayed on 3rd step. And there will be a database query fired after step-2 and step-3 Structure to display items details contains item_pic, Item_name, item_price and availability. How

Files (jQuery, jQuery UI, prototype) from external server

左心房为你撑大大i 提交于 2020-01-06 07:14:22
问题 If I have to load for example jquery.js file among some (let's tell about 10) other css / js files, what is a better approach? load all from the same server that I have my whole app, or use some external servers, like https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js etc. "Using the google.load() method gives your application high speed and global access to a growing list of the most popular, open-source JavaScript libraries" 回答1: Use Google. There's a good chance this will

Backbone.js inaccessible object attributes

本秂侑毒 提交于 2020-01-06 05:49:14
问题 I'm having a problem that I really can't comprehend… I'm not sure if backbone is doing some voodoo to these objects but I can't seem to get even raw access to them. My basic problem is, sometimes when I load the page, fetch the models and render the views one collection will only show/render 50% of the time. I assumed this was an issue with the model not being populated but after some investigation, I could see the model was populated but not accessable. Does anyone have any ideas? I have