File content is restored when running ionic project



I am pretty new to Ionic. I tested with the demo project Blank
ionic start --v2 myApp blank

it works well. Next, I edited the contents of index.html, adding some DOM. However, when ionic serve again, the content of index.html is restored to the original contents.

I also added Android platform. It is same: if editing any files of Android, cordova build will restore the files.

Could you shed a light what I missed? Thank you!


Can you please providethe code you added in the DOM, the version of ionic you are referring to.



e.g. in the default index.html, I added one div, saved the file, and ran ionic serve. the index.html will remove the line of div. the version of ionic is 2.1.18 , I am testing on Windows 10.

Thank you!

(note: to make these code displaying in this textbox in this forum, I intentionally added one space before every tag)

< body>

< div id=“mydiv”>< /div>

< !-- Ionic’s root component and where the app will load -->
< ion-app>

< !-- The polyfills js is generated during the build process -->
< script src=“build/polyfills.js”>

< !-- The bundle js is generated during the build process -->
< script src=“build/main.js”>

< /body>


Since ionic 2 is using angular 2 you do not need to manipulsate the DOM, just create a directive and call that directive on any page you want to use. please see this


Thank you for your guidance! I will take a look this tutorial.

I just thought these files could be edited like a normal one.