Connect codeigniter with polymer - codeigniter

How to intergrate codeigniter and polymer I have kept the webcomponentsjs folder in veiws page and index.html but it is not working. Can any one tell me the solution for integrating codeigniter and polymer

Generally CI and Polymer should be two separate apps; Polymer as frontend app making AJAX calls to the backend CI APIs.
But also you can use Polymer elements inside CI views, just paste this code inside some CI view and it should work: Plunk
...
<paper-textarea
label="textarea label"
on-change="textarea_change"
></paper-textarea>
...

Related

How to make web page load when scrolling in laravel project

I am doing a laravel project. i want to make web page content load when scrolling. i tried with several types. but not suceed.

How to pass data from ASP.NET View to React component in ReactJS.NET

I'm trying out ReactJS.NET in a .NET Core MVC project where I've got an ASP.NET View (cshtml) with a React component in it, which I initialize with:
<script src="#Url.Content("~/Scripts/myComponent.jsx")"></script>
Now I want to pass data from the ASP.NET View to the React component. For example, calling a React function when I click a button on the ASP.NET View. Is this possible? I know it's a basic question but I couldn't find any help since in all examples the data is only passed between React components and not from outside (ASP.NET View).
I couldn't find a way to do what I described in this question. So I ended up coding the whole page in ReactJS, which took some time to get into but it worked out well and I didn't have to mix technologies.
Declare a JS variable in a script and assign a property value from the Model:
<script type="text/javascript">let modelProperty= '#Model.ModelProperty';</script>
<script src="#Url.Content("~/Scripts/myComponent.jsx")"></script>
Then use that modelProperty in your ReactJS script:
ReactDOM.render(<MyComponent prop0={modelProperty} />, document.getElementById("yourTargetElementId"))
Maybe there are more neat solutions...

How to manage React Js to multiple page app not using routes?

I want to implement react js to different pages of my website,
e.g
in home page, registration, login, etc.
all tutorial i have seen it only uses 1 app.js how can i achieve this
to multi page app.
P.S i am using laravel elixir and i combine them into 1 main.js.
Add a mounting point in the pages that you want your React App to be mounted.
e.g.
// main.js
ReactDOM.render(<App props={/* props from somewhere */}/>, document.getElementById('mountingPoint') );
// rendered HTML from pages should have
<div id="mountingPoint"></div>
I found this https://github.com/christianalfoni/react-webpack-cookbook/wiki/Multiple-entry-points
I think this is more appropriate on what i need and then i will just map the file
name in my laravel app.
this way i dont need to load the js code for contact_us.php to login.php
You could also use something like React Habitat to make this architecture easier.
With it, you could just define a container of your components so they resolve in your DOM.
For example, in your javascript you would do
import MyComponent from './Components/MyComponent';
...
container.register(MyComponent).as(myComponent);
Then in any of your HTML pages
<div data-component="myComponent"></div>
It also supports multiple containers and async code splitting.

Confusing about using angularJS with Codigniter

I'm new to front-end MVC and I decide to create a SPApplication then I found this angularJS. Of course, other MVC as well but I prefer angularJS.
Ok, my questions here.
Before this, I normally store my MVC files at backend MVC folders which is codeigniter view folder if it is html partial or page.
So is it the time to move the backend MVC to frontend?
Another question, what is codeigniterRest? do I need it to use with angularJS?
No, the backend MVC in CodeIgniter and the frontend MVC in Angularjs have a separate role totally.
The backend MVC will handle the data sent to the app by your frontend.
The frontend MVC in angularjs will receive a response (usually in json) from the backend MVC in CI and handle that data using its views and controllers.
So your Single Page App will consist of all the bells and whistles of CI + 1 view page (or more if you break that page into partial includes) that will store the angularjs app in it.

how to do to make sure phonegap js load just once time in an app with many separate pages?

Use phonegap 1.6,now called cordova 1.6, with jquery mobile 1.0.1,but I feel performance is a problem.
Also with some other js libs,such as iscroll.js, plus the performance problem.
Can I load phonegap js just once,and later all pages can still use phonegap api?
I have an idea that Page A load phonegap js ,and nested iframe refer Page B.
Page B will replace by other pages. Can Pages in iframe use its parent phonegap api?
eg: parent.(all phonegap api)
You can use jQuery Mobile data-role="page" to define multiple pages on a single html page with one phonegap.js load.
See the docs at http://jquerymobile.com/demos/1.1.0/docs/pages/page-anatomy.html

Resources