gocardless / angularjs-style-guide Goto Github PK
View Code? Open in Web Editor NEWAngularJS style guide used at GoCardless
AngularJS style guide used at GoCardless
First off, thanks a million for the great compilation of wisdom.
I have included this as the GoCardless Way among my collection of ways here to make an Angular app. I also added to the list of factors several new ones from your style guide. They're in the Design section under Approaches. If you'd like to help out with its accuracy or add things I missed, just send me a request to share the doc and I'll add you as an editor.
Why do most of the Style guides are recommending to use one module per file? Isn't a module supposed to be a reusable, self-contained part of an application? Like a bundle. I don't see how a single file is supposed to be as such when it is asking for dependencies for other files.
To me, a module is a component of the application, which is composed of multiple files. Example:
I can understand the need to work like ES6/CommonJS modules, however the angular module definition is much clearer to regroup files under a common cause, the same way Java Packages or Symfony bundles are doing.
Hi,
any basic example app using this style?
thanks
Do you guys have a good argument as to why you shouldn’t use tools like ng-annotate
in favour of using strictDi
?
Just adopted this guide on a new project and digging it. Here are some things that slowed me in the adoption (with opinion on how to change them):
$stateProvider
(from ui-route I believe) I'd expect it to be replaced by $routeProvider
or a reference to be providedIn your section on directives here, you suggest you should use replace. In the next major version AngularJS, they are removing that option. You can read more here: angular/angular.js@eec6394
In any case, I agree you should use elements over attributes.
Hey,
Love this style guide, just a quick question. You mention injecting ready data (https://github.com/gocardless/angularjs-style-guide#inject-ready-data-instead-of-loading-it-in-the-controller).
With this in mind how do you handle interacting with services? I currently have something like this
githubService.getAllRepos().then(function (data) {
ctrl.repos = data.data;
});
What would be the correct way to refactor this so I can use the extend functionality? Thanks guys :)
The guide mentions serving ready data to controllers. That's straight forward for route-controllers,
but with directives there's no such thing as resolv
. How do you handle data specific to a certain directive?
I'm interested in how you guys concatinate/minify your apps? In last few days I'm trying to set some work flow with systemjs features for importing modules but also with external (my own) js libs in ec6, and all of that compiled in one single minified js. What is you expiriance with ithat?
From your style guide:
Use an isolate scope for element directives. Use inherited scope for attribute directives.
How do you do when you have to mix and match many attribute directives in the same element to avoid the scope creation conflict error?
Hello guys,
I'm interesteg in how does look your index.html in relation to this code:
import {mainModule} from './main';
angular.element(document).ready(function() {
angular.bootstrap(document.querySelector('[data-main-app]'), [
mainModule.name
], {
strictDi: true
});
});
I guess you don't have ng-app directive and looking for data-main-app attribute. I have organized my apps similar like that with angular.bootstrap method, but now have some problems with including ui-router in it, Can't find any online resource for using ui-router without ng-app directive.
Thanks a lot.
I personally think that I should always use global filter, put it globally, not locally.
Seems you didn't provide where I should put it, should it be in /helpers
? on anywhere else ?
Do you have global angular object created by including angular.js file or you imports angular somehow in every file where it is needed?
something like:
import angular from './js/angular.js'
angular.module('myModule"...
https://github.com/gocardless/angularjs-style-guide#use-resolvers-to-inject-data
does it disallow you to see modified data after first page load? or you are using some other way to get resolve be called again?
I found this stackoverflow solution, but it is interesting for me to hear how you do it?
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.