How to update angularjs constant during run time?

Question!

I have defined constant in my application as follows,

angular.module('configuration', [])
 .constant('Engine_API', 'http://sample.io:1929/')

And i am using in the application as follows,

var testApp = angular.module('Duot', [ 'configuration']
testApp .controller('userProfileCtrl', function ($scope,Engine_API) {
}

is there a way i can modify and set a new value to the constant in run time?



Answers

You can not change angular constant value. But if you want to change value, you can use angular value provider instead of constant.

angular.module('configuration', [])
 .value('Engine_API', 'http://sample.io:1929/')
By : prasad


If you want to add '0' before the VAT then use CONCAT(args1, args2) method:

select CONCAT('0',VAT) from ExpressMarket;

Note: Both the arguments should be of string type.

Or else you can refer the following to know more about how to concatenate and aliasing it.

MySQL select with CONCAT condition



You should use,

element.submit()

There is a method provided in selenium API to submit form details http://docs.seleniumhq.org/docs/03_webdriver.jsp#user-input-filling-in-forms

From the doc, extracted info for you:

Once you’ve finished filling out the form, you probably want to submit it. One way to do this would be to find the “submit” button and click it:

driver.findElement(By.id("submit")).click();

Alternatively, WebDriver has the convenience method “submit” on every element. If you call this on an element within a form, WebDriver will walk up the DOM until it finds the enclosing form and then calls submit on that. If the element isn’t in a form, then the NoSuchElementException will be thrown:

element.submit();

By : FayazMd


This video can help you solving your question :)
By: admin