|
I want to load all the images from a folder on local by using Jquery/Javascript.
Please help me.
Thanks you!
|
|
|
|
|
Where are you stuck?
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
I'm new in Javascript web applications, I'm more used to creating java/Spring c#/.Net applications, I'm also not a guru in those, though.
What I always do when I create a web application using MVC pattern I do the following:
I create the following folders to organize my code
-View folder: here I put all the HTML files
-Controller folder: here I put all my methods that call the necessary methods to bring me the data that's needed in the views.
-Service folder: here I put all the methods that go to the database to bring info and other necessary methods from the business logic.
-Model folder: here I put all my classes with the attributes example (User class, Role class, Vehicle class, etc).
Example:
public class User {
private name;
.....
getters and setters...
}
I want to apply the same or a similar concept to my Javascript/AngularJS tutorial learning app
So far I have created a very simple app a calculator app with the Service Layer, Controller Layer and View Layer and they work as I expected to work,
the service layer: have all the methods like add, subtracts, multiply.
the view layer: have the html where I input the numbers.
the controller layer: have the method that calls the service and then I pass the data to the view.
BUT my problem is that I don't know how the Model fits in a AngularJS app I have see that some tutorials put the model objects inside the controllers like this
app.controller('BookController', ['$scope', function($scope) {
$scope.book = {
id: 1,
name: 'Harry Potter',
author: 'J. K. Rowling',
stores: [
{ id: 1, name: 'Barnes & Noble', quantity: 3},
{ id: 2, name: 'Waterstones', quantity: 2},
{ id: 3, name: 'Book Depository', quantity: 5}
]
};
}]);
but I don't know if that's the way because if I need a model object in another controller do I need to declare the same code in the other controller??
Also how should I deal with model objects that have inside other model object lets say Users have roles inside them.
where should I put my model objects like User, Role, Vehicle etc? Is there a good approach if I create a .JS file named model.js and put there all the objects like this:
function Apple (type) {
this.type = type;
this.color = "red";
}
Apple.prototype.getInfo = function() {
return this.color + ' ' + this.type + ' apple';
};
But I have read about the global scopes and bad practices etc I actually don't know too much about that if I create that file model.js with my model objects would I be creating a problem?
I'm very open to suggestions since I'm learning
|
|
|
|
|
There's a problem with terminology that you need to wrap your head around before you can really dig in with Angular. The primary issue is that what Angular calls a controller, most everyone else would call a ViewModel (part of why they advertise it as MV-Whatever). More precisely, the $scope on a specific controller is the model that is bound to the interface.
A better way to think of model generation in angular is to consider the prototype/instance relationship. You don't need to reinvent the wheel (or re-implement an object) every time you fire up a $scope. Instead, you can leverage either the service or factory providers to provide the prototypes. Use a service when you need something that has a state to maintain, and use a factory for new, fresh objects.
what I wouldn't do is use vanilla JS definition and prototyping to define objects. This will put them outside of the normal Angular digest cycle, they will not be registered through a provider, and you might find they do not behave as expected. You'll also be skipping out on Dependency Injection, which would be a shame.
For instance:
myApp.factory('appleFactory',[function(){
return {
new : function(type){
return { type : type, color: 'red' };
}
}
}]);
myApp.controller('getMoreApplesController',['$scope','appleFactory',function($scope, Apple){
$scope.firstApple = Apple.new('Golden Delicious');
$scope.secondApple = Apple.new('Washington Red');
}]);
|
|
|
|
|
Hello all,
I am new at javascript and I just learned how to prompt the user for input. But I was wondering how can I keep the prompt box on the screen so additional information can be entered. Once the information is enter the message appears and then the prompt goes away and I have to refresh to make it pop up again.
Thanks
Candi 
|
|
|
|
|
If you need to take multiple information, I would suggest to have a set of text boxes in a page itself instead.
If you need the prompt only, you need to re call the prompt again in loop for all your needed information.
Life is a computer program and everyone is the programmer of his own life.
|
|
|
|
|
Thank you so much. I was able to figure it out.
|
|
|
|
|
Try this but i not sure is this what u wanted, as it have same as title and the need u described !!
in this site on Prompt Box http://www.w3schools.com/js/js_popup.asp
|
|
|
|
|
Thank you so much. I figured it out.
|
|
|
|
|
No, You can't do this. As prompt() is the in built function of JavaScript. So, you can't modify that.
But you can make your own dialogue box not prompt.
|
|
|
|
|
Hi,
I am using Javascript to open the popup in new window but it is opening as a new tab in IE11.
Same code is working in Chrome and get popup in new window but not in IE11 windows 7.
How to achieve this.
If anybody knows please reply me.
Thanks in advance.
|
|
|
|
|
Please note that the popup behavior depends on browser settings.
Please check browser settings, if popup is allowed or not.
Additionally, please provide what code you have used to open the popup so that you can be helped further.
Life is a computer program and everyone is the programmer of his own life.
|
|
|
|
|
Post your code.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Need code on java to integrate fingerprint to php
|
|
|
|
|
For the third time, read:
http://www.codeproject.com/Messages/3587921/How-to-get-an-answer-to-your-question.aspx[^]
Constantly re-posting a demand for someone else to do your job for you is not going to get a result. If anything, it will get you banned from this site.
We're happy to help with specific questions about existing code, but nobody is going to write the code for you.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Member 12195838 wrote: Need code on java to integrate fingerprint to php Refer to your vendor of the fingerprint reader.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Hello,
I am using Joomla CMS, for better performance i have stopped loading javascript at first, but now i am facing other problems.
In my site i have magnifier tool. After forcing javascript stop loading, magnifier stopped working as well.
Ps: Stopped working i refer it doesn't move on mouse over.
Kindly could you please help me with any script to force loading javascripts?
|
|
|
|
|
TaRoshka wrote: Kindly could you please help me with any script to force loading javascripts? I'm confused. You stopped loading the javascripts and now you want us to help you start loading them again? Just undo what you did.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
document.write('<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.4/angular.min.js"><\/script>'); //plugins
|
|
|
|
|
HI there
i am beginner in netbeans and making a program and want to connect it with database, but after writing all the codes for connectivity i get error in "variable declaration". all my codes are correct but without any modification in these i started getting errors.
if someone can use teamviewer and can please solve problem then please message
|
|
|
|
|
Firstly, if all your codes were correct then you would not get error in "variable declaration"..
Secondly this is Java, not Javascript, which is completely different. Please post in the correct forum[^]. Also show the code that gives the error.
|
|
|
|
|
Sagar Singh Rathee wrote: sir will you please help me in this problem by taking remote control of my computer. nobody is there to correct me, and i am not able to solve it by myself
No, sorry, but this forum is for answering questions not for doing your job. As I said before, use the correct forum, and provide proper details of your problem.
|
|
|
|
|
Sagar Singh Rathee wrote: if someone can use teamviewer and can please solve problem then please message No, this site does not work that way.
I'll bet if you google the exact error you'll see what the problem is and hopefully the IDE is pointing you to the line of code that is causing the error. At that point, it should be pretty obvious how to fix this.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Using JQuery or JavaScript, how do I do multiple selects on dropdown so, I can see multiple results in the page?
|
|
|
|
|
You can't select more than one item in a dropdown, you'll need to use a jquery select plug-in that allows for multiple things to be selected.
|
|
|
|