danwahlin / customermanager Goto Github PK
View Code? Open in Web Editor NEWCustomerManager AngularJS/BreezeJS Application with a custom route provider.
License: MIT License
CustomerManager AngularJS/BreezeJS Application with a custom route provider.
License: MIT License
Hi Dan
Your demo application is impressive. I am currently study it to understand how to use Angular.js with MVC.
I have a question regarding the data-pagination used in the demo. I tried to change the page size in data-ng-repeat used in the customers.html, and found that data-pagination still shows the same number of pages, assuming the page size is 10. Is that any way to change the page size (thus increase or decrease the total number of pages)?
Thank you
Nelson
Hi Dan
I try to implement RequireJs in my existing Angularjs App. I did everything that your article mentions but I get the below error.
Do you have any idea why this error?
Uncaught Error: Script error for: /services/routeResolver
http://requirejs.org/docs/errors.html#scripterrormakeError @ require.js:166context.onScriptError @ require.js:1701
I would like to re-use a custom controller and modal template. But ModalService's showModal method assigns secondary object (customModalOptions) only when custom controller isn't defined. So when using custom controller you cannot assign data to that controller when triggering the modal?
Hi
I use your Modal Service to show my template in modal but when i create model on controller and set to $scope and bind to some directive in modal template two-way binding is not worked, how can i change data on controller in modal template?
I would like to see it with a node+mongo backend as you said!
I think will help a lot newcomers like me. thank you for sharing knowledge
Hey, thanks for your git contributions!
I can't seem to get the app to load properly, and I was wondering if you had any suggestions.
So far I get this:
To get the app loaded that far I had to edit a case sensitive typo in index.html
<script src="Scripts/tweenMax.min.js"></script>
to
<script src="Scripts/TweenMax.min.js"></script>
I also changed:
<script src="Scripts/require.js" data-main="scripts/main"></script>
to
<script src="Scripts/require.js" data-main="Scripts/main"></script>
And after those changes the page loaded as pictured above.
From what I can see it seems like main.js
needs some work potentially. Are the javascript files being required properly? They do not need the .js
file ending?
Appreciate any feedback and suggestions! Thanks again!
Hi Dan!
I just tried to use the interceptor but I noticed that nothing happens when I got 401 unauthorized, So I checked the code in refer to the documentation and I found that you return a promise instead of an object of 'request','response' as explained in here.
For example:
$httpProvider.interceptors.push(function($q, dependency1, dependency2) {
return {
'request': function(config) {
// same as above
},
'response': function(response) {
// same as above
}
};
});
when i add new customer->add button click Error (net::ERR_EMPTY_RESPONSE) occurred.
I love the idea you have here and just finished refactoring my code to get a similar pattern working. One big (HUGE) gotcha that took me quite a while to work out, though, was that RequireJS seems to cache any returned object. The result of this is that the creation of the extra property (register) in the app at config time is not persisted to the cached app object. This caused my code to blow up at the registration of the controllers (because register was undefined).
By not returning the app as an object and instead just calling angular.module('myapp').register, I was able to work around it. Just throwing this out there in case anyone else runs across this weirdness (and in case you have some sage advice on the matter).
Hi Dan,
Thank you for your great tutorial and video on 60-ish minutes on Angular - that was my bootstrap help in starting to learn this one-page app framework.
I worked on your customermanagerapp example (not this last release, just the simpler initial one) and I'd like to kindly ask for a briefing to you...
What I want to do is the following:
At the moment, I've been (almost) able to code 3.B, thank also to the work
I say almost cause I want to call data from wikipedia, and I am able to fetch data in a factory but I failed for some reason to pass it to the directive to render the graph (return an undefined).
I have doubt in how to code 3.A.
For example, I have a service fetching data of the objets.
I have a factory fetching additional data for a selected object.
I don't know how to pass the "link" 2. both to 3.A and load the corresponding data in 3.B ...
I have a lot of confusion still...
I am posting you a sample in github:
It is based on your sample project: if you have a little time to give it a look and brief me, REAL MUCH appreciated!!
https://github.com/xdiscovery/angular-viva-route
Thank you very much!
Hi Dan,
I stared node server.js and verified the api/dataservice is OK http://localhost:3000/api/dataservice
I tried to run debug mode in visual studio for the front end however it could not load the customers list due to it was trying to locate the server location on http://localhost:51511/api/dataservice
I tried to open the customersService.js and modified the var serviceBase = '/api/dataservice/' to var serviceBase = 'http://localhost:3000/api/dataservice/'. It throws the exception on XMLHttpRequest cannot load ... Origin is not allowed by Access-Control-Allow-Origin.
Google and I found plenty of solution however I can only manage to fix the GET API e.g able to load customer data by adding Access-Control-Allow-Origin", "*" to server.js.
I could not fix the POST API for the authService.js
Please advise the solution for this.
Thanks
Thomas.
Hello,
I'm impressed with your solution. Thanks
I have a little app using angular hotkeys, but have no idea how to inject into controller.
Would you mind, teach me how
Thanks in advance
Hi there:
I created a new DB on a server, with new tables and each time the application is run from Visual Studio is completely deleted.
It is possible to disable the ongoing creation of the DB ...
I tried to cancel the process from reposiroty or from mongo and continues to create the DB
Thank you
Hi Wahlin,
This is really awesome to improve knowledge on Angular JS and ebook also simply good but I have issues with IE. I encountered an error like "angular is undefined" in IE. I am using IE10. Could you plz help me in this. Thanks in advance.
Thanks,
Srini
Honestly this definition is not clear at all . It was good if somebody who know how we can execute this code take a video of all this instructions in order to be clear. I spent near 2 hours, after having lots of error i change my opinion to continue with it.
What is happen if somebody is not familiar with mongodb. so how we can continue all this steps and so on.
Do you have Unit Test for this project?
My jasmine unit tests are failing to find the controller.
Since the value of app.register.controller is null, because $providers did not get registered in the config while at testing time. It seems app.config is called only when $route is resolved which happens in the normal user navigation scenario.
Any ideas?
Hi Dan,
I tried to install also this last version of the customermanager sample.
I got
/api/dataservice
is missing.
also, how to change the url in require.js to look for the /app/ folder?
(It look for localhost/app/services....., while I want it in localhost/mysite/app .)
Thank you!!
gfdfgdfg
I have mongo running, but can't load the seed files.
Using mac OSX, my terminal output is:
curtiss-mbp:CustomerManager curtiss$ mongo
MongoDB shell version: 2.7.4
connecting to: test
Server has startup warnings:
2014-08-16T18:28:54.115-0400 [initandlisten]
2014-08-16T18:28:54.115-0400 [initandlisten] ** NOTE: This is a development version (2.7.4) of MongoDB.
2014-08-16T18:28:54.115-0400 [initandlisten] ** Not recommended for production.
2014-08-16T18:28:54.115-0400 [initandlisten]
2014-08-16T18:28:54.115-0400 [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
2014-08-16T18:28:54.115-0400 [initandlisten]
use custmgr
switched to db custmgr
load("initMongoCustData.js")
2014-08-16T18:40:33.956-0400 Error: remove needs a query
at Error ()
at DBCollection.remove (src/mongo/shell/collection.js:299:31)
at initMongoCustData.js:65:14
at (shell):1:1 at src/mongo/shell/collection.js:299
2014-08-16T18:40:33.956-0400 Error: error loading js file: initMongoCustData.js
at (shell):1:1
Wondering if I'm missing something here?
The way the routeresolver is written right now, all the controllers have to be in one folder. If we want to differentiate between sections or areas, we would need to modify the resolver. We are considering adding a path parameter to handle folders. What is your opinion on this?
Nice modalService! How do I call modal close from the custom controller which I specified with customModalDefaults?
gfdfgdfg
here is the exception
{ [MongoError: connect ECONNREFUSED] name: 'MongoError', message: 'connect EC
REFUSED' } 'Error: connect ECONNREFUSED\n at exports._errnoException (util
:746:11)\n at TCPConnectWrap.afterConnect as oncomplete
my workaround was npm install
There is no solution file in the download. Errors are generated when you run the application using the .csproj project. Please fix.
I had to make the following changes to the app.js file in order for it to work with express.
I also had to:
npm install mongoose
npm install cookie-parser
npm install express-session
npm install body-parser
npm install method-override
npm install errorhandler
/**
* Module dependencies.
*/
var express = require('express')
, routes = require('./routes')
, api = require('./routes/api')
, DB = require('./accessDB').AccessDB
, protectJSON = require('./lib/protectJSON');
var cookieParser = require('cookie-parser');
var session = require('express-session');
var bodyParser = require('body-parser');
var methodOverride = require('method-override');
var errorhandler = require('errorhandler')
var app = module.exports = express();
var DB = require('./accessDB');
// Configuration
// app.configure(function(){
app.use(protectJSON);
app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
// app.use(express.cookieParser()); //*
app.use(cookieParser());
// app.use(express.session({ secret: 'gopalapuram' })); //*
app.use(session({secret: 'gopalapuram'}));
// app.use(express.bodyParser());
app.use(bodyParser());
// app.use(express.methodOverride());
app.use(methodOverride());
app.use(express.static(__dirname + '/../'));
// app.use(app.router);
// });
var conn = 'mongodb://localhost/custmgr';
var db;
db = new DB.startup(conn);
// development only
if ('development' == app.get('env')) {
// app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
app.use(errorhandler({ dumpExceptions: true, showStack: true }));
}
// production only
if ('production' == app.get('env')) {
// app.use(express.errorHandler());
app.use(errorhandler());
}
function csrf(req, res, next) {
res.locals.token = req.session._csrf;
next();
}
// Routes
app.get('/', routes.index);
// JSON API
app.get('/api/dataservice/Customers', api.customers);
app.get('/api/dataservice/Customer/:id', api.customer);
app.post('/api/dataservice/PostCustomer', api.addCustomer);
app.put('/api/dataservice/PutCustomer/:id', api.editCustomer);
app.delete('/api/dataservice/DeleteCustomer/:id', api.deleteCustomer);
app.get('/api/dataservice/States', api.states);
app.get('/api/dataservice/CustomersSummary', api.customersSummary);
app.get('/api/dataservice/CustomerById/:id', api.customer);
app.get('/api/dataservice/CheckUnique/:email', api.checkemail);
// redirect all others to the index (HTML5 history)
app.get('*', routes.index);
// Start server
app.listen(3000, function(){
console.log("CustMgr Express server listening on port %d in %s mode", this.address().port, app.settings.env);
});
Hi Dan,
Good job.
It will be very interesting if some one can write a Yeoman Generator for this good project.
Regards.
Node - 0.10.15
Mongodb - 2.4.8
Steps to reproduce:
Observed Result:
Blank Page with Title - Customer Manager
Noticed the following errors on Chrome console
Uncaught SyntaxError: Unexpected token < tweenMax.min.js:1
Uncaught SyntaxError: Unexpected token < :3000/scripts/main.js:1
Adil
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.