save rootscope value in the project










0















I have a task to store a model value in my Electron Angular project . The rootscope model is binding the file path value .



I want to save this path on my project and every time when user will open this app by default it will be present there



$rootScope.Path = user_path[0];



I want to save this $rootScope.Path and make the data persist on that location everytime.



Any way to achieve this in electron/node.js ?



EDIT:-



$rootScope.fPath = "C:\";

/*Configure FILE path*/
const dialog = require('electron').remote;
$scope.getFile = function(){
var file_path = dialog.showOpenDialog(
properties: ['openDirectory']
);
console.log(file_path);

$rootScope.fPath = file_path[0] + "\bin";


I want to make this $rootScope.fPath path persist whenever I will open my app the previous selected path must be there already. So that I don't have to make further changes.










share|improve this question
























  • NodeJS: global const variable doesn't satisfy your requirement?

    – Akber Iqbal
    Nov 15 '18 at 12:37











  • @AIqbalRaj Sorry not able to catch you

    – WhoAmI
    Nov 15 '18 at 12:43











  • does this help?... stackoverflow.com/questions/34986922/…

    – Akber Iqbal
    Nov 15 '18 at 12:45











  • @AIqbalRaj Nope , I didn't get yet. I am using angularjs 1.x

    – WhoAmI
    Nov 16 '18 at 5:27











  • Can you share a minimal working example with exactly what you are doing and trying to achieve... that'll help;

    – Akber Iqbal
    Nov 16 '18 at 5:51















0















I have a task to store a model value in my Electron Angular project . The rootscope model is binding the file path value .



I want to save this path on my project and every time when user will open this app by default it will be present there



$rootScope.Path = user_path[0];



I want to save this $rootScope.Path and make the data persist on that location everytime.



Any way to achieve this in electron/node.js ?



EDIT:-



$rootScope.fPath = "C:\";

/*Configure FILE path*/
const dialog = require('electron').remote;
$scope.getFile = function(){
var file_path = dialog.showOpenDialog(
properties: ['openDirectory']
);
console.log(file_path);

$rootScope.fPath = file_path[0] + "\bin";


I want to make this $rootScope.fPath path persist whenever I will open my app the previous selected path must be there already. So that I don't have to make further changes.










share|improve this question
























  • NodeJS: global const variable doesn't satisfy your requirement?

    – Akber Iqbal
    Nov 15 '18 at 12:37











  • @AIqbalRaj Sorry not able to catch you

    – WhoAmI
    Nov 15 '18 at 12:43











  • does this help?... stackoverflow.com/questions/34986922/…

    – Akber Iqbal
    Nov 15 '18 at 12:45











  • @AIqbalRaj Nope , I didn't get yet. I am using angularjs 1.x

    – WhoAmI
    Nov 16 '18 at 5:27











  • Can you share a minimal working example with exactly what you are doing and trying to achieve... that'll help;

    – Akber Iqbal
    Nov 16 '18 at 5:51













0












0








0








I have a task to store a model value in my Electron Angular project . The rootscope model is binding the file path value .



I want to save this path on my project and every time when user will open this app by default it will be present there



$rootScope.Path = user_path[0];



I want to save this $rootScope.Path and make the data persist on that location everytime.



Any way to achieve this in electron/node.js ?



EDIT:-



$rootScope.fPath = "C:\";

/*Configure FILE path*/
const dialog = require('electron').remote;
$scope.getFile = function(){
var file_path = dialog.showOpenDialog(
properties: ['openDirectory']
);
console.log(file_path);

$rootScope.fPath = file_path[0] + "\bin";


I want to make this $rootScope.fPath path persist whenever I will open my app the previous selected path must be there already. So that I don't have to make further changes.










share|improve this question
















I have a task to store a model value in my Electron Angular project . The rootscope model is binding the file path value .



I want to save this path on my project and every time when user will open this app by default it will be present there



$rootScope.Path = user_path[0];



I want to save this $rootScope.Path and make the data persist on that location everytime.



Any way to achieve this in electron/node.js ?



EDIT:-



$rootScope.fPath = "C:\";

/*Configure FILE path*/
const dialog = require('electron').remote;
$scope.getFile = function(){
var file_path = dialog.showOpenDialog(
properties: ['openDirectory']
);
console.log(file_path);

$rootScope.fPath = file_path[0] + "\bin";


I want to make this $rootScope.fPath path persist whenever I will open my app the previous selected path must be there already. So that I don't have to make further changes.







angularjs node.js electron filepath






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 16 '18 at 6:53







WhoAmI

















asked Nov 15 '18 at 12:33









WhoAmIWhoAmI

13211




13211












  • NodeJS: global const variable doesn't satisfy your requirement?

    – Akber Iqbal
    Nov 15 '18 at 12:37











  • @AIqbalRaj Sorry not able to catch you

    – WhoAmI
    Nov 15 '18 at 12:43











  • does this help?... stackoverflow.com/questions/34986922/…

    – Akber Iqbal
    Nov 15 '18 at 12:45











  • @AIqbalRaj Nope , I didn't get yet. I am using angularjs 1.x

    – WhoAmI
    Nov 16 '18 at 5:27











  • Can you share a minimal working example with exactly what you are doing and trying to achieve... that'll help;

    – Akber Iqbal
    Nov 16 '18 at 5:51

















  • NodeJS: global const variable doesn't satisfy your requirement?

    – Akber Iqbal
    Nov 15 '18 at 12:37











  • @AIqbalRaj Sorry not able to catch you

    – WhoAmI
    Nov 15 '18 at 12:43











  • does this help?... stackoverflow.com/questions/34986922/…

    – Akber Iqbal
    Nov 15 '18 at 12:45











  • @AIqbalRaj Nope , I didn't get yet. I am using angularjs 1.x

    – WhoAmI
    Nov 16 '18 at 5:27











  • Can you share a minimal working example with exactly what you are doing and trying to achieve... that'll help;

    – Akber Iqbal
    Nov 16 '18 at 5:51
















NodeJS: global const variable doesn't satisfy your requirement?

– Akber Iqbal
Nov 15 '18 at 12:37





NodeJS: global const variable doesn't satisfy your requirement?

– Akber Iqbal
Nov 15 '18 at 12:37













@AIqbalRaj Sorry not able to catch you

– WhoAmI
Nov 15 '18 at 12:43





@AIqbalRaj Sorry not able to catch you

– WhoAmI
Nov 15 '18 at 12:43













does this help?... stackoverflow.com/questions/34986922/…

– Akber Iqbal
Nov 15 '18 at 12:45





does this help?... stackoverflow.com/questions/34986922/…

– Akber Iqbal
Nov 15 '18 at 12:45













@AIqbalRaj Nope , I didn't get yet. I am using angularjs 1.x

– WhoAmI
Nov 16 '18 at 5:27





@AIqbalRaj Nope , I didn't get yet. I am using angularjs 1.x

– WhoAmI
Nov 16 '18 at 5:27













Can you share a minimal working example with exactly what you are doing and trying to achieve... that'll help;

– Akber Iqbal
Nov 16 '18 at 5:51





Can you share a minimal working example with exactly what you are doing and trying to achieve... that'll help;

– Akber Iqbal
Nov 16 '18 at 5:51












1 Answer
1






active

oldest

votes


















0














having a code snippet helps... is this what you're looking for ??






 

var app = angular.module('myApp', );

app.run(function($rootScope)
$rootScope.fpath = 'http://someSite/someFile';
);

app.controller('myCtrl', function($scope, $rootScope)

console.log("fpath:" + $rootScope.fpath);

$scope.getFile = function()
var file_path = dialog.showOpenDialog(
properties: ['openDirectory']
);


);

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>

<div ng-app="myApp">
<p>The fPath as defined globally: <mark>fpath </mark></p>

<div ng-controller="myCtrl">
<p>The fPath as when accessed in the controller: <mark>fpath</mark> </p>
</div>

</div>








share|improve this answer























  • So if I close my application or redirect to other page , do the declared file path will be there ?

    – WhoAmI
    Nov 16 '18 at 11:59











  • this is accessible inside the AngularJS single-page-application... even if you have a router and move around in the application, it should work

    – Akber Iqbal
    Nov 16 '18 at 12:23











  • Yes , I am doing this in Node/Electron way. I achieved this by using github.com/sindresorhus/electron-store

    – WhoAmI
    Nov 19 '18 at 7:03











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53319614%2fsave-rootscope-value-in-the-project%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














having a code snippet helps... is this what you're looking for ??






 

var app = angular.module('myApp', );

app.run(function($rootScope)
$rootScope.fpath = 'http://someSite/someFile';
);

app.controller('myCtrl', function($scope, $rootScope)

console.log("fpath:" + $rootScope.fpath);

$scope.getFile = function()
var file_path = dialog.showOpenDialog(
properties: ['openDirectory']
);


);

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>

<div ng-app="myApp">
<p>The fPath as defined globally: <mark>fpath </mark></p>

<div ng-controller="myCtrl">
<p>The fPath as when accessed in the controller: <mark>fpath</mark> </p>
</div>

</div>








share|improve this answer























  • So if I close my application or redirect to other page , do the declared file path will be there ?

    – WhoAmI
    Nov 16 '18 at 11:59











  • this is accessible inside the AngularJS single-page-application... even if you have a router and move around in the application, it should work

    – Akber Iqbal
    Nov 16 '18 at 12:23











  • Yes , I am doing this in Node/Electron way. I achieved this by using github.com/sindresorhus/electron-store

    – WhoAmI
    Nov 19 '18 at 7:03
















0














having a code snippet helps... is this what you're looking for ??






 

var app = angular.module('myApp', );

app.run(function($rootScope)
$rootScope.fpath = 'http://someSite/someFile';
);

app.controller('myCtrl', function($scope, $rootScope)

console.log("fpath:" + $rootScope.fpath);

$scope.getFile = function()
var file_path = dialog.showOpenDialog(
properties: ['openDirectory']
);


);

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>

<div ng-app="myApp">
<p>The fPath as defined globally: <mark>fpath </mark></p>

<div ng-controller="myCtrl">
<p>The fPath as when accessed in the controller: <mark>fpath</mark> </p>
</div>

</div>








share|improve this answer























  • So if I close my application or redirect to other page , do the declared file path will be there ?

    – WhoAmI
    Nov 16 '18 at 11:59











  • this is accessible inside the AngularJS single-page-application... even if you have a router and move around in the application, it should work

    – Akber Iqbal
    Nov 16 '18 at 12:23











  • Yes , I am doing this in Node/Electron way. I achieved this by using github.com/sindresorhus/electron-store

    – WhoAmI
    Nov 19 '18 at 7:03














0












0








0







having a code snippet helps... is this what you're looking for ??






 

var app = angular.module('myApp', );

app.run(function($rootScope)
$rootScope.fpath = 'http://someSite/someFile';
);

app.controller('myCtrl', function($scope, $rootScope)

console.log("fpath:" + $rootScope.fpath);

$scope.getFile = function()
var file_path = dialog.showOpenDialog(
properties: ['openDirectory']
);


);

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>

<div ng-app="myApp">
<p>The fPath as defined globally: <mark>fpath </mark></p>

<div ng-controller="myCtrl">
<p>The fPath as when accessed in the controller: <mark>fpath</mark> </p>
</div>

</div>








share|improve this answer













having a code snippet helps... is this what you're looking for ??






 

var app = angular.module('myApp', );

app.run(function($rootScope)
$rootScope.fpath = 'http://someSite/someFile';
);

app.controller('myCtrl', function($scope, $rootScope)

console.log("fpath:" + $rootScope.fpath);

$scope.getFile = function()
var file_path = dialog.showOpenDialog(
properties: ['openDirectory']
);


);

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>

<div ng-app="myApp">
<p>The fPath as defined globally: <mark>fpath </mark></p>

<div ng-controller="myCtrl">
<p>The fPath as when accessed in the controller: <mark>fpath</mark> </p>
</div>

</div>








 

var app = angular.module('myApp', );

app.run(function($rootScope)
$rootScope.fpath = 'http://someSite/someFile';
);

app.controller('myCtrl', function($scope, $rootScope)

console.log("fpath:" + $rootScope.fpath);

$scope.getFile = function()
var file_path = dialog.showOpenDialog(
properties: ['openDirectory']
);


);

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>

<div ng-app="myApp">
<p>The fPath as defined globally: <mark>fpath </mark></p>

<div ng-controller="myCtrl">
<p>The fPath as when accessed in the controller: <mark>fpath</mark> </p>
</div>

</div>





 

var app = angular.module('myApp', );

app.run(function($rootScope)
$rootScope.fpath = 'http://someSite/someFile';
);

app.controller('myCtrl', function($scope, $rootScope)

console.log("fpath:" + $rootScope.fpath);

$scope.getFile = function()
var file_path = dialog.showOpenDialog(
properties: ['openDirectory']
);


);

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>

<div ng-app="myApp">
<p>The fPath as defined globally: <mark>fpath </mark></p>

<div ng-controller="myCtrl">
<p>The fPath as when accessed in the controller: <mark>fpath</mark> </p>
</div>

</div>






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 16 '18 at 9:02









Akber IqbalAkber Iqbal

2,53931225




2,53931225












  • So if I close my application or redirect to other page , do the declared file path will be there ?

    – WhoAmI
    Nov 16 '18 at 11:59











  • this is accessible inside the AngularJS single-page-application... even if you have a router and move around in the application, it should work

    – Akber Iqbal
    Nov 16 '18 at 12:23











  • Yes , I am doing this in Node/Electron way. I achieved this by using github.com/sindresorhus/electron-store

    – WhoAmI
    Nov 19 '18 at 7:03


















  • So if I close my application or redirect to other page , do the declared file path will be there ?

    – WhoAmI
    Nov 16 '18 at 11:59











  • this is accessible inside the AngularJS single-page-application... even if you have a router and move around in the application, it should work

    – Akber Iqbal
    Nov 16 '18 at 12:23











  • Yes , I am doing this in Node/Electron way. I achieved this by using github.com/sindresorhus/electron-store

    – WhoAmI
    Nov 19 '18 at 7:03

















So if I close my application or redirect to other page , do the declared file path will be there ?

– WhoAmI
Nov 16 '18 at 11:59





So if I close my application or redirect to other page , do the declared file path will be there ?

– WhoAmI
Nov 16 '18 at 11:59













this is accessible inside the AngularJS single-page-application... even if you have a router and move around in the application, it should work

– Akber Iqbal
Nov 16 '18 at 12:23





this is accessible inside the AngularJS single-page-application... even if you have a router and move around in the application, it should work

– Akber Iqbal
Nov 16 '18 at 12:23













Yes , I am doing this in Node/Electron way. I achieved this by using github.com/sindresorhus/electron-store

– WhoAmI
Nov 19 '18 at 7:03






Yes , I am doing this in Node/Electron way. I achieved this by using github.com/sindresorhus/electron-store

– WhoAmI
Nov 19 '18 at 7:03




















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53319614%2fsave-rootscope-value-in-the-project%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Top Tejano songwriter Luis Silva dead of heart attack at 64

政党

天津地下鉄3号線