Check out this example of AngularJS code I've created. The factory contains a list of video sources.
var videoPlayer=angular.module('videoPlayer',[])
videoPlayer.controller("videoplayer",["$scope","videolist",function($scope,videolist)
{
$scope.position=0;
$scope.audiolength=videolist.sources.length;
$scope.videosrc=videolist.sources[$scope.position];
console.log($scope.videosrc)
}])
videoPlayer.factory('videolist',function()
{
var videolist={};
videolist.sources=[
'videos\1_visualisation.mp4',
'videos\2_visualisation.mp4',
'videos\3_visualisation.mp4'
]
return videolist;
})
Why is the backslash "\" being removed from the string?
$scope.videosrc=videolist.sources[$scope.position];
When accessing this line of code, it returns "videos1_visualisation.mp4". What could be causing this behavior?