You can use localstorage or sessionstorage, see here the diferences.
The following example demonstrates how to use it for your case
angular.module('myApp', [])
.controller('myCtrl', ['$scope', function($scope) {
var saveVideosToStorage = function(){
localStorage.setItem('videos', angular.toJson($scope.videos));
}
var init = function() {
//load video array from localstorage/sessionStorage
var videos = angular.fromJson(localStorage.getItem('videos'));
if (!(videos instanceof Array)) {
//videos has been corrupted
$scope.videos = [];
saveVideosToStorage();
}
$scope.videos = videos;
}
var addVideoUrl = function(text) {
$scope.videos.push(angular.copy(text)); //HOW I AM TRYING TO SAVE DATA INTO MY ARRAY, VIDEOS
saveVideosToStorage();
}
$scope.addVideoUrl = addVideoUrl;
init();
}]);
and the markup
<div ng-repeat="video in videos track by $index">{{video}}</div>
<input ng-model="videoUrl" type="text"/>
<input type="button" ng-click="addVideoUrl(videoUrl);">
And here is the plunker
NOTE:
I used %scope
instead of the var vm = this
I have found an explanation about localStorage, sessionStorage and cookies that is easy to understand see it here.