Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: config.set not working #5696

Closed
bwalker72956 opened this issue Mar 3, 2016 · 8 comments
Closed

bug: config.set not working #5696

bwalker72956 opened this issue Mar 3, 2016 · 8 comments
Assignees
Milestone

Comments

@bwalker72956
Copy link
Contributor

Type: bug

Ionic Version: 2.x

Platform: all

I was trying to use config.set to set some parameters in the app.ts file using the argument syntax specified in the documentation --> set(platform, key, value) <--. I tried calling the command in the constructor and initializeApp methods.

The method does not appear to have any arguments in IntelliSense which leads me to believe that the method may not be implemented yet.

The get method appears to be fine.

Has config.set been implemented yet?

@Ionitron Ionitron added the v2 label Mar 3, 2016
@brandyscarney
Copy link
Member

Can you paste some of your code? Are you getting errors in the browser console? I added this to the conference app in the constructor of app.js:

this.config.set('ios', 'iconMode', 'md');
console.log(this.config.get('iconMode'));

and I am seeing the icons change to material design mode.

@bwalker72956
Copy link
Contributor Author

CodePen:
http://codepen.io/bwalker729456/pen/EKVxVW?editors=1111

GitHub:
https://github.com/bwalker72956/testIonic2

App Code:
app.zip

I tried the commands in both the app.ts file, page1.ts file and a button click event in page1.

I was able to get the config value to set for all environments by using the following command:
config.set('testVariable','true');. This accomplishes what I was originally trying to accomplish by allow a developer to set an application wide configuration value. I was confused by the documentation since it stated that you should leave the first argument blank (ie. config.set('','testVariable','true');) instead of only passing 2 arguments.

When I tried to set it for a specific environment, it didn't work. I also tried your command and it didn't work. It now appears that the environment specific config.set does not work.

I have a more complete example of code in the GitHub where I put the config statement in the app constructor, page constructor and a button event on page1. I also attached a zip file of the example code I was using.

@brandyscarney
Copy link
Member

Thank you for the great code examples! I am able to see the problem now. 😄

@brandyscarney
Copy link
Member

Ok so the problem is the set function didn't have a proper type definition. Can you follow these steps to develop against Ionic locally and see if the problem is fixed for you? I tested it locally and I see it working, but I would like your confirmation.

From ionic directory:

  1. gulp package build --typecheck
  2. cd dist
  3. npm link (may require sudo)

From your app directory:

  1. npm link ionic-angular
  2. ionic serve

To remove the linked version of ionic-angular do npm rm ionic-angular, and then reinstall using npm install ionic-angular.

@brandyscarney brandyscarney added this to the 2.0.0-beta.3 milestone Mar 4, 2016
@bwalker72956
Copy link
Contributor Author

I am not sure I am understanding the first set of tasks. I tried the gulp command on both a Mac and Windows machine.

I navigated to:
/usr/local/lib/node_modules/ionic-angular
/usr/local/lib/node_modules/ionic

I also tried the ionic-angular directory in the app directory node_modules folder.
I then ran the gulp command, however, I am getting a "no gulp file found" error.

Do I need to install additional npm packages? I did install gulp.

@brandyscarney
Copy link
Member

Sorry. You'll have to clone this repository, then switch to the 2.0 branch, run npm install and then start with the above steps from within the ionic directory. If you'd rather wait to check it against the beta.3 release that's fine too.

@bwalker72956
Copy link
Contributor Author

I cloned the project and gave it a try. That fixed the issue.

Thank you.

@brandyscarney
Copy link
Member

Great! Thank you! The fix will be in the next release. 😄

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants