![]() Now, go into the templates/post folder (where the non-live views live) and copy the contents from into lib/blog_web/live/posts_live/. Create live templateĬreate a file in the blog_web/live/posts_live folder called. We could add a render function to our module, satisfying the error, but we’re going to take a different approach. Now our module is defined, but we get an error from Phoenix because render is not implemented. Inside that file define the module like so: defmodule do Within this directory add a file called index.ex. Add another new directory called posts_live. This is where your live-view related code will live. Define moduleĬreate a directory under lib/blog_web called live. If you hit localhost4000/postslive in your browser right now you should get an error because the module BlogWeb.PostsLive is not available. In your router.ex file, after pipe_through: :browser, add something like this: live “/postslive”, PostsLive.Index 1: Define live routeįirst we need to define a route to our live view. Now here we go with the cool stuff: converting this default index page into a live view, so that when you create, update or delete posts any browser window that’s pointed at the page will update automatically, no refresh required. This is pretty much the simplest possible Phoenix app. Back on the posts index page you’ll see the default links for looking at, editing and deleting your new post. Follow the links to create a new post and save it to the database. Now you can boot up your server with mix phx.server and visit localhost:4000/posts to see your (empty) list of posts. ![]() Mix Posts Post posts title:string body:textĪs prompted, add the posts resource to your router in the browser scope: Use the handy generator tool to create the Post controller, context and views: When asked if you want to fetch and install dependencies, say yes (Y)Įnter the blog folder and set up the database: If your app already exists, skip ahead to step 1.įrom your preferred directory, run this command: Note: If you are using a Phoenix version earlier than v1.5, make sure you I’ll start by quickly bootstrapping a blog application with a single resource, posts. We will be building a dead-simple example in order to maximize the likelihood that you’ll be able to easily grok the steps and use them in your own projects. I won’t be going into detail about how all the features work, but even if you’ve never used it before you should be able to follow along and get up and running easily. LiveView powered applications are stateful on the server with bidirectional communication via WebSockets, offering a vastly simplified programming model compared to JavaScript alternatives.” “Phoenix LiveView is an exciting new library which enables rich, real-time user experiences with server-rendered HTML. From Chris McCord’s announcement of the library: Reset everything and BANG - Live View is workinf through my browser.This is a guide for converting an existing Phoenix view into a LiveView. I went to the NVR configuration > Local Configuration > Protocol ![]() I googled and eventually found the solution buried in another post. Live view is working fine in iVMS and EZViz I tried everything I could think of - uninstalled and reinstalled "WebComponents", disabled Firewalls, &c. Only to be replaced with a pop up saying "Live View Failed" The dreaded plugin message had gone - Yippee I installed the extension, and I fired up IE, turned on compatibility mode, added all the correctIP address, changed the security settings to allow AxtiveX and make the NVR IP a trusted site.įired up the browser and logged into the NVR. So this has been bugging me for a while, as many of you will know (and some won't), HikVison's web-based user interface requires the NPAPI plugin, which is no longer supported by many browser manufacturers.Ģ of these (for Windows at least) are the IE Tab Extension for Google Chrome or plain old Internet Explorer in compatibility mode.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |