Hey guys, learned Javascript and Angular some little time ago. In fact, I'm 
not that good at it and I'd need more practice. I did a little project, but 
in the end, I saw that I had done all my scripts on my index page. I 
learned Java and I learned to use the MVC way, with a "Worker" file which 
does the work, and so we only had to do calls on other classes. Is it 
possible to do the same here? Like, I'd have a file with all the scripts, 
and I'd do only calls on my index page. Is it worth it ? (It's a web site 
where I just do some little stuff, just to practice so it's not that big).
Tell me what do you need to have a better understanding of the question.
Here are my scrypts:


        //Youtube API
            var tag = document.createElement('script');

            tag.src = "https://www.youtube.com/iframe_api";;
            var firstScriptTag = document.getElementsByTagName('script')[0];
            firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);

            var player;
            function onYouTubeIframeAPIReady() {
                player = new YT.Player('player', {
                    height: '390',
                    width: '640',
                    videoId: '9qfb3IlH56I',
                    events: {
                        'onReady': onPlayerReady,
                        'onStateChange': onPlayerStateChange
                    }
                });
            }


            function onPlayerReady(event) {
                event.target.playVideo();
            }

            var done = false;
            function onPlayerStateChange(event) {
                if (event.data == YT.PlayerState.PLAYING && !done) {
                    done = true;
                }
            }
            function stopVideo() {
                player.stopVideo();
            }


            //Roads

            var module = angular.module("animeNet", ['ngRoute']);
            module.config(['$routeProvider',
                function($routeProvider) {
                    $routeProvider.
                            when('/', {
                                templateUrl: 'Login.php'

                            }).
                            when('/anime', {
                                templateUrl: 'anime.html'

                            }).
                            when('/logInFail', {
                                templateUrl: 'logInFail.php'
                            }).
                            when('/api', {
                                templateUrl: 'Api.html'
                            }).
                            when('/home', {
                                templateUrl: 'home.php'}).
                            when('/inscription', {
                                templateUrl: 'inscription.php'}).
                            when('/test', {
                                templateUrl: 'test.html'}).
                            otherwise({
                                redirectTo: '/'
                            });


                }]);
            
            //Controller

            module.controller("RouteController", function($scope, 
$rootScope, $routeParams, $location) {
                $scope.param = $routeParams.param;



                $rootScope.$on('$routeChangeStart', function(event, next, 
current) {

                    $scope.routeShow = $location.path() != '/' && 
$location.path() != '/inscription';
                });
            });
            
            
            //AnimationsOnIndex

            var _gaq = _gaq || [];
            _gaq.push(['_setAccount', 'Key']);
            _gaq.push(['_trackPageview']);
            (function() {
                var ga = document.createElement('script');
                ga.type = 'text/javascript';
                ga.async = true;
                ga.src = ('https:' == document.location.protocol ? 
'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
                var s = document.getElementsByTagName('script')[0];
                s.parentNode.insertBefore(ga, s);
            })();

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to