Last active
December 17, 2015 01:28
-
-
Save liorkesos/5528234 to your computer and use it in GitHub Desktop.
A sequence of files which get called and enable an angular.js app
The app structure looks like this
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.app = angular.module('myApp', ['ngCookies', 'ngResource']); | |
//Setting up route | |
window.app.config(['$routeProvider', function($routeProvider) { | |
$routeProvider. | |
when('/', { redirectTo: '/home' }). | |
when('/home', { templateUrl: 'views/main.html' }). | |
when('/youtube', { templateUrl: 'views/youtube.html' }). | |
when('/404', { templateUrl: 'views/404.html' }). | |
otherwise({redirectTo: '/404'}); | |
}]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app | |
index.html | |
app.js | |
css/ | |
js/ | |
controllers/ | |
youtubeSearch.js | |
services/ | |
views/ | |
main.html | |
404.html |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html data-ng-app="myApp"> | |
<link rel="stylesheet" href="css/lib/bootstrap.min.css"> | |
<body> | |
<section class="content" data-ng-view></section> | |
</body> | |
<script src="js/lib/angular.min.js"></script> | |
<script src="js/lib/angular-cookies.min.js"></script> | |
<script src="js/lib/angular-resource.min.js"></ script> | |
<script src="js/app.js"></script> | |
<script src="js/directives.js"></script> | |
<script src="js/youtubeSearch.js"></script> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1> My Youtube Search app</h1> | |
<div data-ng-include="'views/navigation.html'"></div> | |
<div ng-app="youtubeSearchApp" data-ng-controller="youtubeSearchController"> | |
<div class="player"> | |
<div data-ng-include="'views/bigVideo.html'" ></div> | |
</div> | |
<div class="wrap"> | |
<div class="search" data-ng-include="'views/searchYouTube.html'"></div> | |
</div> | |
<div class="playlist" data-ng-include="'views/playListYouTube.html'"> </div> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function youtubeSearchController($scope, YouTube, Cube) { | |
$scope.CubeService = Cube; | |
$scope.stores=[]; | |
$scope.doSearch = function(query){ | |
if (query=="") | |
query=query+'?'; | |
if (query!=null) | |
$scope.videos = YouTube.get({q: query}); | |
} | |
$scope.doStore=function (video) { | |
$scope.stores.push(video); | |
console.log($scope.stores); | |
} | |
$scope.doBig=function (video) { | |
$scope.BigVideo=video; | |
} | |
$scope.remove = function ( idx ) { | |
var store_to_delete = $scope.stores[idx]; | |
$scope.stores.splice( $scope.stores.indexOf(store_to_delete), 1 ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment