AngularJS: full use of AngularJS functions / structures

I am working on a web application with AngularJS, which I just started learning some time ago. I find it extremely useful, but after working on it for several days, I decided that the application would be launched sooner or later, since I wrote all my "backend" code in one controller. The application uses many HTTP requests to receive / send / delete / post data from / to remote servers, as well as many area variables that are necessary in order to manipulate the page anyway.

I checked a lot of tutorials / informational sites on AngularJS (a similar question , a great blog post for example), but I'm still not sure how to implement one of my own applications. I was wondering what is the usual case using your own service / module / directive / factory? I hope to rebuild my code a bit, so everything will seem more organized; at the moment I think that I am not fully using AngularJS with all my code in one place and without using any services / modules other than my main application and controller module and the built-in $ http.

So, you can better understand my problem while I use only two javascript files, the first of which is app.js:

var app = angular.module('MyAppName',[]);

and the second one is controller.js (for this I could use only 1 file):

app.controller("MyController", function($scope, $http){
    // all my functions/variables in here
   // I initialize them  with $scope.someName = … if they are needed within this controller view.
  //  If they are not needed within view I initialize them (functions for instance)
 // as functionName = function(){};
}

Everything works as it should, but I think this approach does not use all the features of AngularJS. For example: I do not use routing, which I probably should? (URL remains unchanged all the time). I also do not use any other additional angularJS functions, such as user services / directives / modules.

So, I ask: how can I restructure my code so that it uses more AngularJS functions and that it remains readable? When do you usually create your own service / module / factory? I somehow didn’t understand everything on the AngularJS website, perhaps because I started to develop too early, without sufficient knowledge, and now I hardly get it (there is too much two-way binding and immediately started coding).

.

EDIT: , , : / , . , (30+) -, ​​ , , / , / .… / , , .

EDIT2: , , , , , , , ng-click ... $scope, ... , , .

+3
2

, AngularJS. :

, .

angular -seed:

https://github.com/angular/angular-seed

: angular -enterprise-seed:

https://github.com/robertjchristian/angular-enterprise-seed

, , "" , AngularJS + [ ]. , Express.js, angular -express-seed:

https://github.com/btford/angular-express-seed

+2

- Angular JS - . Extensible - AngularJS . .

- AngularJS . (). factory .

- AngularJS

- AngularJS , AngularJS. , .

http://astutejs.blogspot.in/2015/06/advantages-of-angular-js.html

0

All Articles