AgeManning / EthereumMiningCalculator

Advanced statistics for mining ethereum and other cryptocurrencies.
https://thecalc.io
16 stars 11 forks source link

Dynamically Change Text in Directives #34

Closed AgeManning closed 8 years ago

AgeManning commented 8 years ago

For our directives in forecaster.html, we have info-text="".

It would be nice if we could dynamically change this. Specifically for difficulty a, I would like to say something different depending on what userInputs.difficultyType is. If its too hard, doesn't matter I can make the text generic.

AgeManning commented 8 years ago

I'm in the process of generalizing the calc for btc. The difficulty algorithm is different for BTC (I'm still going to measure this in THs tho). Also its no longer reasonable to measure hashrate in MH/s for BTC. So we need to change the title for hashrate if they select btc to GH/S.

paulhauner commented 8 years ago

I believe we can do dynamic text for the info-text attribute using handlebars.

Eg, info-text="{{ mySpecialLilVariable }}"

AgeManning commented 8 years ago

I swear I tried that. Can you code a quick example. eg If currency is BTC, change the hashrate text to from (MH/s) to (GH/s).

paulhauner commented 8 years ago

I just tested it and it works

forecaster-controller.js:

$scope.fuckshittest = "meow";

forecaster.html

<!-- Cryptocurrency -->
  <forecaster-input-list
    component-id="cryptocurrency"
    component-name="Cryptocurrency"
    info-text="{{ fuckshittest }}"
    ng-show="isVisible.cryptocurrency">
  </forecaster-input-list>
AgeManning commented 8 years ago

Perfect, I'll sort it from here. I assume it works for component-name also?

paulhauner commented 8 years ago

Yep I would assume so - they're both the same sort of reference in the directive (@)