Angular create two cookies with same name and diff path - angularjs

Im using cookie in two difference controllers ,but it is doesnt rewrite value and create a new one,so i have two cookies with same name and difference path.How can i make to rewrite it?

Related

Paramater concat inline

In my Logic App, i have 2 parameters username and tenant. I need to concat these 2 with an '#' in the middle. I tried to concat it using below tries and none worked.
#{concat([parameters('username')],'#',[parameters('tenant')])}
#{concat([parameters('username')],''#'',[parameters('tenant')])}
#{concat(parameters('username'),'#',parameters('tenant'))}
Finally i had to create 3 seperate variables to hold each value and concat it and that worked.
#{concat(variables('username'),variables('at'),variables('tenant'))}
Is there any better way to do this?
Here is the app
Here is the parameters for app, username and password is fetched from params file
Here is the error when run

How to prevent hard-coding in angular application

I am currently working on a angular project where I find myself injecting hard-coded values of string, numbers, etc into html template.I have tried to store hard-coded values in object fields and inject the object into whichever component needs it. However it does not seem very intuitive. Is there way to get values from some properties file like we do in Java. I would also like to know what are some of the best practices that you developers are using to prevent that?
You can do it with a properties file as well. The best way would be to create a json file, e.g., example.json and calling in the json and then just making an API call like:
$http.get('your_web_address/example.json')
.success(function(data){
// assign the data to a var or write next logic directly
})
and then use the content of json as per choice
You can make this as a service call as well, if you want

How to pass value from module to module of different page in Angularjs

I am new to Angularjs and have a scenario where two pages using 2 modules on each page ie M1 and M2.
Both modules having his own controllers C1 & C2. I want to pass value from C1 to C2. I tried with service but its not working. Can able to set value in first page but get value null on second page.
Can someone point me in the correct direction how to pass values between modules?
You need to set a dependency of M1 on M2. After that you will be able to access the services of M1 through which you can establish a communication between two controllers.
If it's on a separate pages, you either have to use the server to save the data on Page1 then load it on Page2 or use some sort of local storage on the client side(cookies, localStorage)

Pyrocms Getting Values at front end

I am new to pyrocms.
How can I get database values on pages of pyrocms. In website of pyrocms I had created a listing page now I want to display database values from pyro database table.
I got your question, you want to create a listing on your front-end page for some database table values which you want to access through your custom module controller. there are many ways to get these values but the simplest way is to use ajax. you already have Jquery added in pyrocms so you can simply make a call to your controller method in ajax and get your required output as HTML and display it in the div element on your page.
$.ajax({
type:"POST",
url:"admin/your-controller-name/your-method-name",
success:function(html){
$('yourdiv').html(html);
}
})
In your controller create a method which get data from database and print it using echo create some listing table etc what you want.
i think you will get my point. if confuse then get back to me
You need to be more specific as PyroCMS has lots of components and each module (blogs, variables, widgets, file uploads etc.) uses specific tags you insert into the page. You may come across references to 'Lex' - that's the name of the parser used to display them.
Tags documentation
PyroCMS (the Professional edition) also has a feature called "Streams" which allows you to build custom databases and this in turn has it's own series of tags.

Grab a variable from the URL and then pass it to a controller CakePHP 2.0

I'm trying to build a sort of Wordpress-esque CMS system to a project I'm building. I want the user to be able to create pages on the fly, and for them to appear in certain areas of the website.
I have made something similar in Symfony2, where the controller grabs a specific variable from the URL (as definded in the route.yml file, usually $id etc) and I then use the variable in the controller to display whatever content it relates to in the database.
However, I'm not used to CakePHP 2.0, and struggling to find what I need. I know it's possible, but I don't know the best way to achieve it. Especially as CakePHP uses a different routes file than Symfony.
How would I grab a variable from the URL and pass it for use inside a controller?
By variable do you mean GET query string parameters, like in /foo?key=value? You can access them in the controller through the request object: $this->request->query['key'].
If you are looking for something more integrated you can use CakePHP's default routes or make your own.
The default routes work with URLs like /controller/action/param1/param2 and pass the parameters to the action by position. For instance /posts/view/521 maps to a call to view(521) in PostsController, and /posts/byMonth/2012/02 maps to a call to byMonth("2012","02").
You can also use named parameters and the URLs look like /controller/action/key1:value1/key2:value2. In controller actions you would read them with $this->params['named']['key1'].
With custom routes you can make your URLs anything you want. You're not forced to the /controller/action pattern; you can make /archives/2012-02 map to PostsController::byMonth(2012,2), or have /512-post-title map to PostsController::view(512).
Typically you would start out with the default routes and add custom routes when you decide you need them. You can read all about the default and custom routes in http://book.cakephp.org/2.0/en/development/routing.html
Short answer: it depends.
If you're looking to pass parameters to a function, you don't need to mess with routes at all; every non-named URL path segment is processed in order and handed to the action as method parameters (so /controller/action/1234 passes "1234" as the first parameter to the action method in the controller controller class).
Named parameters allow you to pass parameters anywhere in the URL string, and to make them optional. The form is just key:value and they're accessed via $this->params['named'] in the controller.
The last option is prefix routing. The best place to get to speed on that is naturally the CakePHP Cookbook, but the general gist is that in a route definition, you can name a path component in the URL by prefixing it with a colon, identically to how the default routes show :controller, :plugin and :action. You can define any name you like, even optionally applying regex pattern requirements and then access it through $this->params['variablename'] in the controller.

Resources